Last active
November 17, 2017 11:11
-
-
Save mcaskill/3df63784daa66d4fd0f7 to your computer and use it in GitHub Desktop.
WordPress : Determine if a query variable is set.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Check if the current variable is set, and is not NULL, in the WP_Query class. | |
* | |
* @see WP_Query::$query_vars | |
* @uses $wp_query | |
* | |
* @param string $var The variable key to be checked. | |
* @return bool True if the current variable is set. | |
*/ | |
function has_query_var( $var ) { | |
global $wp_query; | |
return isset( $wp_query->query_vars[ $var ] ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment