0

I have a Custom Post Type with an Archive page. I have a filter form on the page so the user can select some options and then find matching results.

How can I stop posts being displayed (using the loop) until a filter search is made by the user?

2
  • How are you doing the filtering? Feb 9, 2018 at 12:30
  • fetching posts that have certain taxonomy terms, using the meta_query WP_Query args. Feb 9, 2018 at 12:38

1 Answer 1

0

Isn't this easily to be achieved by checking if ?s= is set ? You do have to output the results of this search on the same page, by using the post archive link as action url.

if ( isset( $_GET[s] ) { // show posts }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.