Last active
October 7, 2016 00:39
-
-
Save harisrozak/872f28d6e54f0855ce8113ac9bbb49ea to your computer and use it in GitHub Desktop.
WordPress :: How to get get_query_var working
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 | |
| // register query_var on funtions.php | |
| add_filter('query_vars', 'add_my_var'); | |
| function add_my_var($public_query_vars) { | |
| $public_query_vars[] = 'your_query_var'; | |
| return $public_query_vars; | |
| } | |
| // get query var | |
| $your_query_var = get_query_var('your_query_var', 1); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment