Make WordPress Core


Ignore:
Timestamp:
09/11/2013 12:01:19 AM (11 years ago)
Author:
wonderboymusic
Message:

Add term_taxonomy_id to available fields in get_term_by(). Adds unit test.

Props jchristopher.
Fixes #21651.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/taxonomy.php

    r25257 r25334  
    955955 * @see sanitize_term_field() The $context param lists the available values for get_term_by() $filter param.
    956956 *
    957  * @param string $field Either 'slug', 'name', or 'id'
     957 * @param string $field Either 'slug', 'name', 'id' (term_id), or 'term_taxonomy_id'
    958958 * @param string|int $value Search for this term value
    959959 * @param string $taxonomy Taxonomy Name
     
    977977        $value = wp_unslash($value);
    978978        $field = 't.name';
     979    } else if ( 'term_taxonomy_id' == $field ) {
     980        $value = (int) $value;
     981        $field = 'tt.term_taxonomy_id';
    979982    } else {
    980983        $term = get_term( (int) $value, $taxonomy, $output, $filter);
Note: See TracChangeset for help on using the changeset viewer.