Make WordPress Core


Ignore:
Timestamp:
08/29/2012 01:42:11 PM (12 years ago)
Author:
ryan
Message:

Simplify return from WP_Post::get() now that references are no longer returned. see #21309

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/post.php

    r21654 r21655  
    490490    public function __get( $key ) {
    491491        if ( 'page_template' == $key && $this->__isset( $key ) ) {
    492             $_ref = get_post_meta( $this->ID, '_wp_page_template', true );
     492            return get_post_meta( $this->ID, '_wp_page_template', true );
    493493        }
    494494
    495495        if ( 'post_category' == $key ) {
    496             if ( is_object_in_taxonomy( $this->post_type, 'category' ) ) {
    497                 $_ref = wp_get_post_categories( $this->ID );
    498             } else {
    499                 $_ref = array();
    500             }
     496            if ( is_object_in_taxonomy( $this->post_type, 'category' ) )
     497                return wp_get_post_categories( $this->ID );
     498            else
     499                return array();
    501500        }
    502501
    503502        if ( 'tags_input' == $key ) {
    504             if ( is_object_in_taxonomy( $this->post_type, 'post_tag' ) ) {
    505                 $_ref = wp_get_post_tags( $this->ID, array( 'fields' => 'names' ) );
    506             } else {
    507                 $_ref = array();
    508             }
    509         }
    510 
    511         if ( isset( $_ref ) )
    512             return $_ref;
     503            if ( is_object_in_taxonomy( $this->post_type, 'post_tag' ) )
     504                return wp_get_post_tags( $this->ID, array( 'fields' => 'names' ) );
     505            else
     506                return array();
     507        }
    513508
    514509        // Rest of the values need filtering
    515510
    516         if ( 'ancestors' == $key ) {
     511        if ( 'ancestors' == $key )
    517512            $value = get_post_ancestors( $this );
    518         } else {
     513        else
    519514            $value = get_post_meta( $this->ID, $key, true );
    520         }
    521 
    522         if ( $this->filter ) {
     515
     516        if ( $this->filter )
    523517            $value = sanitize_post_field( $key, $value, $this->ID, $this->filter );
    524         }
    525518
    526519        return $value;
Note: See TracChangeset for help on using the changeset viewer.