php - Search custom post on basis of post_content, metaboxes and taxonomy -


// start query      $v_args = array(         'post_type'     =>  'listing',         'meta_query' => array(                     array(                     'key'     => 'wpcf-services',                     'value'   => $services,                     'compare' => 'like',                     ),                     ),         'tax_query' =>array(                         'relation' => 'and',                 array(                         'taxonomy' => 'listing-city',                         'field' => 'name',                         'terms' => $location,                         'compare' => 'like',                         'operator' => 'in'                 ),                 array(                         'taxonomy' => 'listing-category',                         'field' => 'name',                         'terms' => $listing_category,                         'compare' => 'like',                         'operator' => 'in'                 ),                 ),      );       $listingsearch = new wp_query( $v_args );?> 

this search working fine custom post type want search on post_content how achieve this.

this search work on custom meta , taxonomy not on post_content

my requirement when enter value in $services textbox compare value post_content , metabox (wpcf-services) both or logic

any ?

thanks in advance

try below code for, if you,

$v_args = array(     'post_type'     =>  'listing',     's' => $services_textbox,     'meta_query' => array(                 'relation' => 'or',                 array(                 'key'     => 'wpcf-services',                 'value'   => $services,                 'compare' => 'like',                 ),                 ),     'tax_query' =>array(                     'relation' => 'and',             array(                     'taxonomy' => 'listing-city',                     'field' => 'name',                     'terms' => $location,                     'compare' => 'like',                     'operator' => 'in'             ),             array(                     'taxonomy' => 'listing-category',                     'field' => 'name',                     'terms' => $listing_category,                     'compare' => 'like',                     'operator' => 'in'             ),             ),      );      $listingsearch = new wp_query( $v_args ); 

Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -