Make WordPress Core

Ticket #27015: 27015.patch

File 27015.patch, 2.4 KB (added by bcworkz, 12 years ago)
  • src/wp-includes/query.php

     
    32763276                                        $term = get_term_by( 'slug', $this->get( 'category_name' ), 'category' );
    32773277                                }
    32783278                        } elseif ( $this->is_tag ) {
    3279                                 $term = get_term( $this->get( 'tag_id' ), 'post_tag' );
     3279                                if ( $this->get( 'tag_id' ) )
     3280                                        $term = get_term( $this->get( 'tag_id' ), 'post_tag' );
     3281                                elseif ($this->get( 'tag' ) )
     3282                                        $term = get_term_by( 'slug', $this->get( 'tag' ), 'post_tag' );
    32803283                        } else {
    32813284                                $tax_query_in_and = wp_list_filter( $this->tax_query->queries, array( 'operator' => 'NOT IN' ), 'NOT' );
    32823285                                $query = reset( $tax_query_in_and );
     
    33063309                        $page_for_posts = get_option('page_for_posts');
    33073310                        $this->queried_object = get_post( $page_for_posts );
    33083311                        $this->queried_object_id = (int) $this->queried_object->ID;
    3309                 } elseif ( $this->is_singular && !is_null($this->post) ) {
    3310                         $this->queried_object = $this->post;
    3311                         $this->queried_object_id = (int) $this->post->ID;
     3312                } elseif ( $this->is_singular ) {
     3313                        if ( isset( $this->post ) ) {
     3314                                $this->queried_object = $this->post;
     3315                                $this->queried_object_id = (int) $this->post->ID;
     3316                        } elseif ( $this->get('p') ) {
     3317                                $this->queried_object = get_post( $this->get('p'));
     3318                                $this->queried_object_id = $this->get('p');
     3319                        } elseif ( $this->get('page_id') ) {
     3320                                $this->queried_object = get_post( $this->get('page_id'));
     3321                                $this->queried_object_id = $this->get('page_id');
     3322                        } elseif ( $this->get('name') ) {
     3323                                $this->queried_object = $this->post = get_page_by_path(
     3324                                        $this->get('name'),
     3325                                        OBJECT,
     3326                                        $this->get('post_type') ? $this->get('post_type') :'post'
     3327                                );
     3328                                $this->queried_object_id = (int) $this->post->ID;
     3329                        }
    33123330                } elseif ( $this->is_author ) {
    3313                         $this->queried_object_id = (int) $this->get('author');
    3314                         $this->queried_object = get_userdata( $this->queried_object_id );
     3331                        if ( $this->get('author') ) {
     3332                                $this->queried_object_id = (int) $this->get('author');
     3333                                $this->queried_object = get_userdata( $this->queried_object_id );
     3334                        } elseif ($this->get('author_name')) {
     3335                                $this->queried_object = get_user_by( 'login', $this->get('author_name') );
     3336                                $this->queried_object_id = (int) $this->queried_object->ID;             
     3337                        }
    33153338                }
    33163339
    33173340                return $this->queried_object;