Skip to content

Instantly share code, notes, and snippets.

@isGabe
Last active December 13, 2015 19:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save isGabe/4965476 to your computer and use it in GitHub Desktop.
Save isGabe/4965476 to your computer and use it in GitHub Desktop.
WordPress: get_queried_object() returns for different objects #snippet #WordPress
/**
* 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