WordPress.org

Make WordPress Core

Changeset 15586


Ignore:
Timestamp:
09/07/10 04:29:00 (4 years ago)
Author:
markjaquith
Message:

Make the second (taxonomy) parameter for get_term_link() optional if you pass in a term object as the first argument (which has the taxonomy in it). fixes #13081. props scribu

Location:
trunk/wp-includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/classes.php

    r15409 r15586  
    13411341        extract($args); 
    13421342 
    1343         $cat_name = esc_attr( $category->name); 
     1343        $cat_name = esc_attr( $category->name ); 
    13441344        $cat_name = apply_filters( 'list_cats', $cat_name, $category ); 
    1345         $link = '<a href="' . get_term_link( $category, $category->taxonomy ) . '" '; 
     1345        $link = '<a href="' . esc_attr( get_term_link($category) ) . '" '; 
    13461346        if ( $use_desc_for_title == 0 || empty($category->description) ) 
    13471347            $link .= 'title="' . sprintf(__( 'View all posts filed under %s' ), $cat_name) . '"'; 
  • trunk/wp-includes/taxonomy.php

    r15583 r15586  
    24822482 * 
    24832483 * @param object|int|string $term 
    2484  * @param string $taxonomy 
     2484 * @param string $taxonomy (optional if $term is object) 
    24852485 * @return string HTML link to taxonomy term archive 
    24862486 */ 
    2487 function get_term_link( $term, $taxonomy ) { 
     2487function get_term_link( $term, $taxonomy = '') { 
    24882488    global $wp_rewrite; 
    24892489 
     
    25012501    if ( is_wp_error( $term ) ) 
    25022502        return $term; 
     2503 
     2504    $taxonomy = $term->taxonomy; 
    25032505 
    25042506    // use legacy functions for core taxonomies until they are fully plugged in 
     
    25982600 
    25992601        foreach ( $terms as $term ) 
    2600             $links[] = "<a href='" . esc_attr(get_term_link($term, $taxonomy)) . "'>$term->name</a>"; 
     2602            $links[] = "<a href='" . esc_attr( get_term_link($term) ) . "'>$term->name</a>"; 
    26012603 
    26022604        if ( $links ) 
Note: See TracChangeset for help on using the changeset viewer.