Pass query parameters
-
Hey!
I have a custom post type I am using relevanssi to search through, except I want to pass a meta_query parameter to the search to exclude certain posts that have an Advance Custom Field True/False field checked.
I’m trying (which may be wrongly) to use WP_Query as pass the search term in as a parameter but it is not displaying the results I am looking for.
<?php $args = array( 'post_type' => $_GET['search-type'], 'posts_per_page' => 3, 's' => $_GET['s'], 'meta_query' => array( array( 'key' => 'work_hidden', 'value' => '0', 'compare' => '=' ) ) ); $the_query = new WP_Query( $args ); if ( $the_query->have_posts() ) { while ( $the_query->have_posts() ) { $the_query->the_post(); include "partials/work-card-new.php"; } } ?>
In theory this query should work fine, but from the research I’ve done I may need to use a Relevanssi function to pass my meta_query into the search. Any help is appreciated thank you!
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Pass query parameters’ is closed to new replies.