get_object_taxonomies() WP 1.0
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' )
Basis of: is_object_in_taxonomy(), get_the_taxonomies()
1 time = 0.000055s = very fast | 50000 times = 0.90s = very fast
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. Array. $wp_taxonomies The registered taxonomies.
Changelog
Since 2.3.0 | Introduced. |
Code of get_object_taxonomies() get object taxonomies WP 5.6
Related Functions
From category: For posts
- get_objects_in_term()
- get_the_category()
- get_the_category_list()
- get_the_tag_list()
- get_the_tags()
- get_the_taxonomies()
- get_the_term_list()
- get_the_terms()
- has_category()