Sometime’s we need to fetch some posts of a custom posts types according to the title. Here, we are discussing the situation where we need to fetch the posts of a custom post type which is similar to the title we are putting there. It is a case of similar text in terms of post title for custom post types.

For this we need to pass search parameter of wp_query. Now we are taking an example, we need to fetch posts of a custom post type “event”. So, we will use the below mentioned code :

$my_title_value = 'hello'; // we need to put the value of the post title like which we want to fetch using this query

$my_args = array( 
          'post_type'  => 'event',
		  "s" => $my_title_value,

$custom_query = new WP_Query( $my_args );

if ( $custom_query->have_posts() ) {
	while ( $custom_query->have_posts() ) {

?><a href="<?php the_permalink();?>"><?php the_title();?></a><br/><?php

          } // while loop ends

The result of the above loop will output all the post titles of a post type “event” which are having words like “hello”. We can use the above code while making your own filer by using queries.

Happy coding 🙂