get_object_taxonomies [ WordPress Function ]
get_object_taxonomies ( $object, $output = 'names' )
| Parameters: |
|
| Uses: |
|
| Returns: |
|
| Defined at: |
|
Similar Functions: get_post_taxonomies, get_the_taxonomies, get_taxonomies, the_taxonomies, get_attachment_taxonomies
Return all of the taxonomy names that are of $object_type.
It appears that this function can be used to find all of the names inside of $wp_taxonomies global variable.
get_object_taxonomies('post'); ?>
Should result in
Array('category', 'post_tag')Source
<?php
function get_object_taxonomies($object, $output = 'names') {
global $wp_taxonomies;
if ( is_object($object) ) {
if ( $object->post_type == 'attachment' )
return get_attachment_taxonomies($object);
$object = $object->post_type;
}
$object = (array) $object;
$taxonomies = array();
foreach ( (array) $wp_taxonomies as $tax_name => $tax_obj ) {
if ( array_intersect($object, (array) $tax_obj->object_type) ) {
if ( 'names' == $output )
$taxonomies[] = $tax_name;
else
$taxonomies[ $tax_name ] = $tax_obj;
}
}
return $taxonomies;
}
?>
Examples [ wp-snippets.com ]
Top Google Search Results
- Function Reference/get object taxonomies « WordPress Codex
Function Reference/get object taxonomies ... <?php print_r( get_object_taxonomies('post')); ?> ... foreach ( get_object_taxonomies( 'post' ) as $tax_name ) { ...
codex.wordpress.org - custom taxonomy - How to get all taxonomies of a post type ...
Jun 21, 2011 ... After looking at couple of functions in taxonomy.php file in wordpress i have found this function get_object_taxonomies(); which did the tricks :) ...
wordpress.stackexchange.com - Michael Fields » get_object_taxonomies()
get_object_taxonomies(). One entry is associated with the term get_object_taxonomies(). Subscribe. Post Title, Comment Count, Comment Link. Set Default ...
wordpress.mfields.org - get_object_taxonomies (WordPress Function) - WPSeek.com
WordPress lookup for get_object_taxonomies, a WordPress Function. wpseek. com is a WordPress-centric search tool for developers and theme authors.
wpseek.com