Force wordpress to ignore my custom query args
-
I have a number of custom query args that my plugin uses, only a couple of which are actually related to changing the posts query. The rest of them are related to the plugin and perform such functions as outputting certain confirmation or error messages for example.
My problem is this: how can I force WP to ignore the query args that are “mine”?
As an example, my home page is a static page that contains a number of shortcodes to output the custom login form, a few links to some information and a link to the registration form. If a user logs in and that login fails for whatever reason, I go back to the home page appending ?err=LOGIN to the url (but it could actually be any of the custom query args I’ve specified). The home page now displays the Hello World post!?
It seems that ANY query arg (that has previously been specified) appended to the URL will cause WP to ignore the static page and instead show the list of posts (of which there are none, this being a paged site).
The only way I can think of making sure the page that holds the home page shortcodes is always shown when is_home() or is_front_page() is true, is hook into pre_get_posts, but this seems a bit janky.
Is there a mechanism where we can register query args to be available to get_query_var() but not automatically kick off the posts query?
- The topic ‘Force wordpress to ignore my custom query args’ is closed to new replies.