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? – Jacob Peattie Feb 9 '18 at 12:30
  • fetching posts that have certain taxonomy terms, using the meta_query WP_Query args. – Paul Canning Feb 9 '18 at 12:38
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, privacy policy and cookie policy

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