Function: get_the_taxonomies

get_the_taxonomies( integer | WP_Post $post, array $args )

Retrieve all taxonomies associated with a post.

Shortcut: gtt

You can use above key combination to trigger the associated snippet for this function in the WordPress Snippets for Visual Studio Code extension. You can also use this shortcut to search for this function on this website.

This function can be used within the loop. It will also return an array of the taxonomies with links to the taxonomy and name.

Parameters

Name Type(s) Default Value Description
$post integer | WP_Post

Optional. Post ID or WP_Post object. Default is global $post.

$args array array()

{ Optional. Arguments about how to format the list of taxonomies. Default empty array.

@type string $template      Template for displaying a taxonomy label and list of terms.
                            Default is "Label: Terms."
@type string $term_template Template for displaying a single term in the list. Default is the term name
                            linked to its archive.

}

Returns

array

List of taxonomies.

WordPress Developer Newsletter

Stay informed of new chapter releases, important WordPress API updates and more.