WordPress.org

Make WordPress Core

Ticket #13081: get_term_link.diff

File get_term_link.diff, 1.9 KB (added by scribu, 11 years ago)
  • wp-includes/taxonomy.php

     
    23632363 * @since 2.5.0
    23642364 *
    23652365 * @param object|int|string $term
    2366  * @param string $taxonomy
     2366 * @param string $taxonomy (optional if $term is object)
    23672367 * @return string HTML link to taxonomy term archive
    23682368 */
    2369 function get_term_link( $term, $taxonomy ) {
     2369function get_term_link( $term, $taxonomy = '') {
    23702370        global $wp_rewrite;
    23712371
    23722372        if ( !is_object($term) ) {
     
    23832383        if ( is_wp_error( $term ) )
    23842384                return $term;
    23852385
     2386        $taxonomy = $term->taxonomy;
     2387
    23862388        // use legacy functions for core taxonomies until they are fully plugged in
    23872389        if ( $taxonomy == 'category' )
    23882390                return get_category_link((int) $term->term_id);
     
    24792481                $links = array();
    24802482
    24812483                foreach ( $terms as $term )
    2482                         $links[] = "<a href='" . esc_attr(get_term_link($term, $taxonomy)) . "'>$term->name</a>";
     2484                        $links[] = "<a href='" . esc_attr( get_term_link($term) ) . "'>$term->name</a>";
    24832485
    24842486                if ( $links )
    24852487                        $taxonomies[$taxonomy] = wp_sprintf($t['template'], $t['label'], $links, $terms);
  • wp-includes/classes.php

     
    14361436        function start_el(&$output, $category, $depth, $args) {
    14371437                extract($args);
    14381438
    1439                 $cat_name = esc_attr( $category->name);
     1439                $cat_name = esc_attr( $category->name );
    14401440                $cat_name = apply_filters( 'list_cats', $cat_name, $category );
    1441                 $link = '<a href="' . get_term_link( $category, $category->taxonomy ) . '" ';
     1441                $link = '<a href="' . esc_attr( get_term_link($category) ) . '" ';
    14421442                if ( $use_desc_for_title == 0 || empty($category->description) )
    14431443                        $link .= 'title="' . sprintf(__( 'View all posts filed under %s' ), $cat_name) . '"';
    14441444                else