Changeset 19678 for trunk/wp-includes/taxonomy.php
- Timestamp:
- 01/04/2012 10:44:19 PM (15 years ago)
- File:
-
- 1 edited
-
trunk/wp-includes/taxonomy.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/taxonomy.php
r19600 r19678 1496 1496 1497 1497 /** 1498 * Check if a term is an ancestor of another term. 1499 * 1500 * You can use either an id or the term object for both parameters. 1501 * 1502 * @since 3.4.0 1503 * 1504 * @param int|object $term1 ID or object to check if this is the parent term. 1505 * @param int|object $term2 The child term. 1506 * @param string $taxonomy Taxonomy name that $term1 and $term2 belong to. 1507 * @return bool Whether $term2 is child of $term1 1508 */ 1509 function term_is_ancestor_of( $term1, $term2, $taxonomy ) { 1510 if ( ! isset( $term1->term_id ) ) 1511 $term1 = get_term( $term1, $taxonomy ); 1512 if ( ! isset( $term2->parent ) ) 1513 $term2 = get_term( $term2, $taxonomy ); 1514 1515 if ( empty( $term1->term_id ) || empty( $term2->parent ) ) 1516 return false; 1517 if ( $term2->parent == $term1->term_id ) 1518 return true; 1519 1520 return term_is_ancestor_of( $term1, get_term( $term2->parent, $taxonomy ), $taxonomy ); 1521 } 1522 1523 /** 1498 1524 * Sanitize Term all fields. 1499 1525 *
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)