Custom post type search
-
Hello,
Thanks for this awesome plugin and its maintenance! I have a quick question, for some reasons search results are not showing posts that have exact title match.
I am building query based on params in the URL like this:
$builder_args = array( 'post_type' => 'builder', 'posts_per_page' => 12, 'paged' => get_query_var( 'paged', 1 ), 'order' => 'desc', 'orderby' => 'menu_order date' ); if($_GET['keywords']) { $builder_args['s'] = $_GET['keywords']; } if($_GET['builder-category'] || $_GET['builder-type']) { if($_GET['builder-category'] && $_GET['builder-type']) { $builder_args['tax_query']['relation'] = 'and'; } if($_GET['builder-category']) { $builder_args['tax_query'][] = [ 'taxonomy' => 'builder-category', 'field' => 'slug', 'terms' => [$_GET['builder-category']] ]; } if($_GET['builder-type']) { $builder_args['tax_query'][] = [ 'taxonomy' => 'builder-type', 'field' => 'slug', 'terms' => [$_GET['builder-type']] ]; } } $builder = new WP_Query($builder_args);
If you can advise or need any debug information, I will be happy to provide it.
Best regards,
AlexThe page I need help with: [log in to see the link]
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Custom post type search’ is closed to new replies.