WordPress.org

Make WordPress Core

Ticket #14156: get_term_link.patch

File get_term_link.patch, 721 bytes (added by sudar, 5 years ago)

Path which adds the third parameter to get_term_link function

  • taxonomy.php

     
    24732473 * 
    24742474 * @param object|int|string $term 
    24752475 * @param string $taxonomy 
     2476 * @param string $field Either 'slug', 'name', or 'id' 
    24762477 * @return string HTML link to taxonomy term archive 
    24772478 */ 
    2478 function get_term_link( $term, $taxonomy ) { 
     2479function get_term_link( $term, $taxonomy, $field = 'slug' ) { 
    24792480        global $wp_rewrite; 
    24802481 
    24812482        if ( !is_object($term) ) { 
    24822483                if ( is_int($term) ) { 
    24832484                        $term = &get_term($term, $taxonomy); 
    24842485                } else { 
    2485                         $term = &get_term_by('slug', $term, $taxonomy); 
     2486                        $term = &get_term_by($field, $term, $taxonomy); 
    24862487                } 
    24872488        } 
    24882489