term_is_ancestor_of [ WordPress Function ]
term_is_ancestor_of ( $term1, $term2, $taxonomy )
| Parameters: |
|
| Returns: |
|
| Defined at: |
|
Benzer Fonksiyonlar: cat_is_ancestor_of, get_post_ancestors, get_ancestors, _get_post_ancestors, permalink_anchor
Check if a term is an ancestor of another term.
You can use either an id or the term object for both parameters.
Source
<?php
function term_is_ancestor_of( $term1, $term2, $taxonomy ) {
if ( ! isset( $term1->term_id ) )
$term1 = get_term( $term1, $taxonomy );
if ( ! isset( $term2->parent ) )
$term2 = get_term( $term2, $taxonomy );
if ( empty( $term1->term_id ) || empty( $term2->parent ) )
return false;
if ( $term2->parent == $term1->term_id )
return true;
return term_is_ancestor_of( $term1, get_term( $term2->parent, $taxonomy ), $taxonomy );
}
?>
Examples [ wp-snippets.com ]
Google Arama Sonuçlarý
- garyc40-15581.patch on Ticket #15581 – Attachment – WordPress ...
... $taxonomy ) || ( $cat_ID && term_is_ancestor_of( $cat_ID, ...
core.trac.wordpress.org - term_is_ancestor_of (WordPress Function) - WPSeek.com
WordPress lookup for term_is_ancestor_of, a WordPress Function. wpseek.com is a WordPress-centric search tool for developers and theme authors.
wpseek.com - cat_is_ancestor_of (WordPress Function) - WPSeek.com
Similar Functions: term_is_ancestor_of, get_post_ancestors, get_ancestors, _get_post_ancestors, ... return term_is_ancestor_of( $cat1, $cat2, 'category' ); } ? > ...
wpseek.com - <?php // test the functions for fetching taxonomy meta data class ...
... 'category', array( 'parent' => $t['term_id'] ) ); if ( function_exists( ' term_is_ancestor_of' ) ) { $this->assertTrue( term_is_ancestor_of( $t['term_id'], $ t2['term_id'], ...
svn.automattic.com