Make WordPress Core


Ignore:
Timestamp:
11/20/2012 06:31:06 PM (12 years 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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.