WP_Query Not Working When ?s= is Set
-
I use custom queries to pull specific posts by category or pagename etc in some custom functions and template. However when a search is performed and the “s” variable is set in the url on the search page it will not show those items. I am creating said request using a new WP_Query instance ($myQuery = new WP_Query($args);) but the “s=whatever” argument seems to be finding its way into those new queries as well.
I have tried wp_reset_query, wp_reset_postdata and just about anything else I could find by searching. Again, everything works as it should except for on the search.php page when the “s” variable is set on the url.
Please help, I don’t want to tell the customer that that page just isn’t supposed to have the features all the other do.
An example of the code is here FYI:
- The topic ‘WP_Query Not Working When ?s= is Set’ is closed to new replies.