Make WordPress Core


Ignore:
Timestamp:
03/12/2014 04:07:41 AM (10 years ago)
Author:
wonderboymusic
Message:

In WP_Query::get_queried_object(), account for pre_get_posts by checking for tag when tag_id isn't present. Tags still need to be rolled up into tax_query. Add a unit test confirming expected query vars during and after pre_get_posts.

Props mattonomics for a patch.
See #27362.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/query.php

    r27456 r27511  
    36643664                }
    36653665            } elseif ( $this->is_tag ) {
    3666                 $term = get_term( $this->get( 'tag_id' ), 'post_tag' );
     3666                if ( $this->get( 'tag_id' ) ) {
     3667                    $term = get_term( $this->get( 'tag_id' ), 'post_tag' );
     3668                } elseif ( $this->get( 'tag' ) ) {
     3669                    $term = get_term_by( 'slug', $this->get( 'tag' ), 'post_tag' );
     3670                }
    36673671            } else {
    36683672                $tax_query_in_and = wp_list_filter( $this->tax_query->queries, array( 'operator' => 'NOT IN' ), 'NOT' );
Note: See TracChangeset for help on using the changeset viewer.