Skip to content

Instantly share code, notes, and snippets.

@marcosnakamine
Last active July 5, 2017 21:20
Show Gist options
  • Save marcosnakamine/6139d7ab8f4a4cf96b915528bc61d36c to your computer and use it in GitHub Desktop.
Save marcosnakamine/6139d7ab8f4a4cf96b915528bc61d36c to your computer and use it in GitHub Desktop.
WordPress - Get current taxonomy
<?
var_dump( get_queried_object() );
/*OR*/
$terms = get_the_terms( get_the_ID(), 'taxonomy');
/*
object(WP_Term)#9039 (11) {
["term_id"]=>
int(80)
["name"]=>
string(2) "NAME"
["slug"]=>
string(2) "name"
["term_group"]=>
int(0)
["term_taxonomy_id"]=>
int(80)
["taxonomy"]=>
string(22) "taxonomy_name"
["description"]=>
string(0) ""
["parent"]=>
int(0)
["count"]=>
int(1)
["filter"]=>
string(3) "raw"
["term_order"]=>
string(1) "0"
}
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment