WordPress.org

Make WordPress Core

Changeset 20622


Ignore:
Timestamp:
04/27/12 19:23:57 (3 years ago)
Author:
nacin
Message:

Don't call get_the_category() in get_the_category_list() unless the post type supports categories. props niallkennedy. fixes #19671.

File:
1 edited

Legend:

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

    r20549 r20622  
    154154function get_the_category_list( $separator = '', $parents='', $post_id = false ) { 
    155155    global $wp_rewrite; 
     156    if ( ! is_object_in_taxonomy( get_post_type( $post_id ), 'category' ) ) 
     157        return apply_filters( 'the_category', '', $separator, $parents ); 
     158 
    156159    $categories = get_the_category( $post_id ); 
    157     if ( !is_object_in_taxonomy( get_post_type( $post_id ), 'category' ) ) 
    158         return apply_filters( 'the_category', '', $separator, $parents ); 
    159  
    160160    if ( empty( $categories ) ) 
    161161        return apply_filters( 'the_category', __( 'Uncategorized' ), $separator, $parents ); 
Note: See TracChangeset for help on using the changeset viewer.