Make WordPress Core

Changeset 11263


Ignore:
Timestamp:
05/11/2009 04:37:42 PM (17 years ago)
Author:
ryan
Message:

Accept only IDs for get_term_link(). Prop filosofo. fixes #9323

Location:
trunk/wp-includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/category-template.php

    r11204 r11263  
    888888
    889889        foreach ( $terms as $term ) {
    890                 $link = get_term_link( $term, $taxonomy );
     890                $link = get_term_link( $term->term_id, $taxonomy );
    891891                if ( is_wp_error( $link ) )
    892892                        return $link;
  • trunk/wp-includes/taxonomy.php

    r11260 r11263  
    21522152 * @since 2.5.0
    21532153 *
    2154  * @param object|int|string $term
     2154 * @param int $term_id The term id for which to get a link.
    21552155 * @param string $taxonomy
    21562156 * @return string HTML link to taxonomy term archive
    21572157 */
    2158 function get_term_link( $term, $taxonomy ) {
     2158function get_term_link( $term_id, $taxonomy ) {
    21592159        global $wp_rewrite;
    2160 
    2161         if ( !is_object($term) ) {
    2162                 if ( is_int($term) ) {
    2163                         $term = &get_term($term, $taxonomy);
    2164                 } else {
    2165                         $term = &get_term_by('slug', $term, $taxonomy);
    2166                 }
    2167         }
     2160        $term_id = intval($term_id);
     2161
     2162        // use legacy functions for core taxonomies until they are fully plugged in
     2163        if ( $taxonomy == 'category' )
     2164                return get_category_link((int) $term_id);
     2165        if ( $taxonomy == 'post_tag' )
     2166                return get_tag_link((int) $term_id);
     2167       
     2168        $term = &get_term($term_id, $taxonomy);
     2169
    21682170        if ( is_wp_error( $term ) )
    21692171                return $term;
    2170 
    2171         // use legacy functions for core taxonomies until they are fully plugged in
    2172         if ( $taxonomy == 'category' )
    2173                 return get_category_link((int) $term->term_id);
    2174         if ( $taxonomy == 'post_tag' )
    2175                 return get_tag_link((int) $term->term_id);
    21762172
    21772173        $termlink = $wp_rewrite->get_extra_permastruct($taxonomy);
Note: See TracChangeset for help on using the changeset viewer.