WordPress.org

Make WordPress Core

Changeset 22722


Ignore:
Timestamp:
11/20/12 18:31:06 (17 months ago)
Author:
ryan
Message:

Don't bail from get_the_terms() if the post type is not registed for the taxonomy. This can break back compat when add_post_type_support( 'page', 'post-formats' ) is called but register_taxonomy_for_object_type( 'postr_-format', 'page' ) is not.

Props SergeyBiryukov
fixes #22473

Location:
trunk/wp-includes
Files:
2 edited

Legend:

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

    r22412 r22722  
    10631063        return false; 
    10641064 
    1065     if ( ! is_object_in_taxonomy( $post->post_type, $taxonomy ) ) 
    1066         return false; 
    1067  
    10681065    $terms = get_object_term_cache( $post->ID, $taxonomy ); 
    10691066    if ( false === $terms ) { 
  • trunk/wp-includes/post.php

    r22676 r22722  
    616616 
    617617        if ( 'post_category' == $key ) { 
    618             $terms = get_the_terms( $this, 'category' ); 
    619             if ( ! $terms ) 
     618            if ( is_object_in_taxonomy( $this->post_type, 'category' ) ) 
     619                $terms = get_the_terms( $this, 'category' ); 
     620 
     621            if ( empty( $terms ) ) 
    620622                return array(); 
    621623 
     
    624626 
    625627        if ( 'tags_input' == $key ) { 
    626             $terms = get_the_terms( $this, 'post_tag' ); 
    627             if ( ! $terms ) 
     628            if ( is_object_in_taxonomy( $this->post_type, 'post_tag' ) ) 
     629                $terms = get_the_terms( $this, 'post_tag' ); 
     630 
     631            if ( empty( $terms ) ) 
    628632                return array(); 
    629633 
Note: See TracChangeset for help on using the changeset viewer.