wpseek.com
Eine auf WordPress spezialiserte Suchmaschine für Entwickler und Theme-Autoren
get_term_children [ WordPress Function ]
| Parameter: |
|
| Nutzt: |
|
| Gibt zurück: |
|
| Definiert in: |
|
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;
}
?>
Beispiele [ wp-snippets.com ]
Top Google Suchergebnisse
- 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() | Rachel Carden
get_term_children(). This WordPress function requires the CPT-onomy class. Description; Usage; Parameters; Return Values; Examples; Related Functions ...
rachelcarden.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