get_object_taxonomies()
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.
Example:
$taxonomies = get_object_taxonomies( 'post' );
This results in:
Array( 'category', 'post_tag' )
Used By: get_the_taxonomies(), is_object_in_taxonomy()
1 time — -0.00003 sec (speed of light) | 50000 times — 0.20 sec (very fast) | PHP 7.4.25, WP 5.9.2
No Hooks.
Return
String[]|WP_Taxonomy[]
. The names or objects of all taxonomies of $object_type.
Usage
get_object_taxonomies( $object, $output );
- $object(string|string[]|WP_Post) (required)
- Name of the type of taxonomy object, or an object (row from posts)
- $output(string)
- The type of output to return in the array. Accepts either 'names' or 'objects'.
Default: 'names'
Notes
- Global. WP_Taxonomy[]. $wp_taxonomies The registered taxonomies.
Changelog
Since 2.3.0 | Introduced. |