Make WordPress Core

Ticket #27015: 27015.2.patch

File 27015.2.patch, 1.8 KB (added by bcworkz, 12 years ago)

Refreshed after Trac#27362

  • src/wp-includes/query.php

     
    37003700                        $page_for_posts = get_option('page_for_posts');
    37013701                        $this->queried_object = get_post( $page_for_posts );
    37023702                        $this->queried_object_id = (int) $this->queried_object->ID;
    3703                 } elseif ( $this->is_singular && !is_null($this->post) ) {
    3704                         $this->queried_object = $this->post;
    3705                         $this->queried_object_id = (int) $this->post->ID;
     3703                } elseif ( $this->is_singular ) {
     3704                        if ( isset( $this->post ) ) {
     3705                                $this->queried_object = $this->post;
     3706                                $this->queried_object_id = (int) $this->post->ID;
     3707                        } elseif ( $this->get('p') ) {
     3708                                $this->queried_object = get_post( $this->get('p'));
     3709                                $this->queried_object_id = $this->get('p');
     3710                        } elseif ( $this->get('page_id') ) {
     3711                                $this->queried_object = get_post( $this->get('page_id'));
     3712                                $this->queried_object_id = $this->get('page_id');
     3713                        } elseif ( $this->get('name') ) {
     3714                                $this->queried_object = $this->post = get_page_by_path(
     3715                                        $this->get('name'),
     3716                                        OBJECT,
     3717                                        $this->get('post_type') ? $this->get('post_type') :'post'
     3718                                );
     3719                                $this->queried_object_id = (int) $this->post->ID;
     3720                        }
    37063721                } elseif ( $this->is_author ) {
    3707                         $this->queried_object_id = (int) $this->get('author');
    3708                         $this->queried_object = get_userdata( $this->queried_object_id );
     3722                        if ( $this->get('author') ) {
     3723                                $this->queried_object_id = (int) $this->get('author');
     3724                                $this->queried_object = get_userdata( $this->queried_object_id );
     3725                        } elseif ($this->get('author_name')) {
     3726                                $this->queried_object = get_user_by( 'login', $this->get('author_name') );
     3727                                $this->queried_object_id = (int) $this->queried_object->ID;             
     3728                        }
    37093729                }
    37103730
    37113731                return $this->queried_object;