WordPress.org

Make WordPress Core

Changeset 11324


Ignore:
Timestamp:
05/14/2009 04:09:01 AM (9 years ago)
Author:
ryan
Message:

Revert [11263]. Busted several themes. see #9323

Location:
trunk/wp-includes
Files:
2 edited

Legend:

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

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

    r11263 r11324  
    21522152 * @since 2.5.0
    21532153 *
    2154  * @param int $term_id The term id for which to get a link.
     2154 * @param object|int|string $term
    21552155 * @param string $taxonomy
    21562156 * @return string HTML link to taxonomy term archive
    21572157 */
    2158 function get_term_link( $term_id, $taxonomy ) {
     2158function get_term_link( $term, $taxonomy ) {
    21592159    global $wp_rewrite;
    2160     $term_id = intval($term_id);
     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    }
     2168    if ( is_wp_error( $term ) )
     2169        return $term;
    21612170
    21622171    // use legacy functions for core taxonomies until they are fully plugged in
    21632172    if ( $taxonomy == 'category' )
    2164         return get_category_link((int) $term_id);
     2173        return get_category_link((int) $term->term_id);
    21652174    if ( $taxonomy == 'post_tag' )
    2166         return get_tag_link((int) $term_id);
    2167    
    2168     $term = &get_term($term_id, $taxonomy);
    2169 
    2170     if ( is_wp_error( $term ) )
    2171         return $term;
     2175        return get_tag_link((int) $term->term_id);
    21722176
    21732177    $termlink = $wp_rewrite->get_extra_permastruct($taxonomy);
Note: See TracChangeset for help on using the changeset viewer.