id summary reporter owner description type status priority milestone component version severity resolution keywords cc focuses 27209 Add a has_query_var function ndobie "Because {{{get_query_var}}} returns an empty string even if the query var is not set, you have to use the global {{{$wp_query}}} variable to check if it is set when using a custom endpoint that does not need a value. For example I have a plugin that returns statistics on tags and categories by adding a /stats/ endpoint. I currently have to evaluate as so: {{{ global $wp_query; // Skip if not a stats request if (!(isset($wp_query->query_vars['stats']) && (is_tag() || is_category()))) { return; } }}} I'd like to just be able to use the following: {{{ // Skip if not a stats request if (!(has_query_var('stats') && (is_tag() || is_category()))) { return; } }}} Alternatively {{{get_query_var}}} could return a {{{NULL}}} value when the query var doesn't exist." feature request closed normal Query 3.8.1 normal duplicate