get_object_taxonomies

SummerySummery

Return the names or objects of the taxonomies which are registered for the requested object or object type, such as a post object or post type name.

Syntax

get_object_taxonomies( string|string[]|WP_Post $object, string $output = 'names' )

DescriptionDescription

Example:

$taxonomies = get_object_taxonomies( 'post' );

This results in:

Array( 'category', 'post_tag' )

ParametersParameters

$object

(string|string[]|WP_Post) (Required) Name of the type of taxonomy object, or an object (row from posts)

$output

(string) (Optional) The type of output to return in the array. Accepts either 'names' or 'objects'.

Default value: 'names'

ReturnReturn

(string[]|WP_Taxonomy[]) The names or objects of all taxonomies of $object_type.

SourceSource

File: wp-includes/taxonomy.php


			

ChangelogChangelog

Changelog
Version Description
2.3.0 Introduced.
Scroll to Top