get_term_children [ WordPress Function ]
| Parameters: |
|
| Uses: |
|
| Returns: |
|
| Defined at: |
|
Merge all term children into a single array of their IDs.
This recursive function will merge all of the children of $term into the same array of term IDs. Only useful for taxonomies which are hierarchical.
Will return an empty array if $term does not exist in $taxonomy.
Source
<?php
function get_term_children( $term_id, $taxonomy ) {
if ( ! taxonomy_exists($taxonomy) )
return new WP_Error('invalid_taxonomy', __('Invalid Taxonomy'));
$term_id = intval( $term_id );
$terms = _get_term_hierarchy($taxonomy);
if ( ! isset($terms[$term_id]) )
return array();
$children = $terms[$term_id];
foreach ( (array) $terms[$term_id] as $child ) {
if ( isset($terms[$child]) )
$children = array_merge($children, get_term_children($child, $taxonomy));
}
return $children;
}
?>
Examples [ wp-snippets.com ]
Google Arama Sonuçlarý
- Function Reference/get term children « WordPress Codex
Description. Merge all term children into a single array. This recursive function will merge all of the children of $term into the same array. Only useful for ...
codex.wordpress.org - Custom taxonomy children (get_term_children) - BUG? - WordPress
Custom taxonomy children (get_term_children) - BUG? (3 posts). miradev. Member Posted 1 year ago #. I can't get WP to give me child terms on a custom ...
wordpress.org - get_term_children (WordPress Function) - WPSeek.com
WordPress lookup for get_term_children, a WordPress Function. wpseek.com is a WordPress-centric search tool for developers and theme authors.
wpseek.com - get_term_children | A HitchHackers guide through WordPress
Feb 12, 2011 ... function get_term_children( $term_id, $taxonomy ) { if ( ! taxonomy_exists($ taxonomy) ) return new WP_Error('invalid_taxonomy', __('Invalid ...
hitchhackerguide.com