Last active
December 13, 2015 19:48
-
-
Save isGabe/4965476 to your computer and use it in GitHub Desktop.
WordPress: get_queried_object() returns for different objects #snippet #WordPress
This file contains 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
/** | |
* I wanted to know what get_queried_object() returns for different things in WordPress. | |
* | |
*/ | |
// I use this to grab the array returned | |
// depending on what is being queried, it will return a different array of values | |
<?php | |
$object = get_queried_object(); | |
var_dump($object); | |
?> | |
// taxonomy.php -> taxonomy term template | |
/* | |
object(stdClass)#350 (9) { ["term_id"]=> string(1) "3" ["name"]=> string(13) "Contract Work" ["slug"]=> string(13) "contract-work" ["term_group"]=> string(1) "0" ["term_taxonomy_id"]=> string(1) "3" ["taxonomy"]=> string(11) "project_tag" ["description"]=> string(0) "" ["parent"]=> string(1) "0" ["count"]=> string(1) "2" } | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment