Skip to:

Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#2278 closed defect (bug) (invalid)

Query for topic set as is_home

Reported by: mzaweb's profile MZAWeb Owned by:
Milestone: Priority: normal
Severity: normal Version: 2.1
Component: Component - Topics Keywords:
Cc: wordpress@…


When you query a single topic, the resulting WP_Query has is_home as true and is_singular as false.

To replicate:

var_dump( new WP_Query( 'topic=test' ) );

Replace 'test' with the post_name of one of your topics

Change History (3)

#1 @MZAWeb
11 years ago

  • Cc wordpress@… added
  • Keywords 2nd-opinion added

WP's parse_query doesn't seem to handle custom post types query_vars to set is_single.

This feels more like a hack than a solution, but it works:

add_filter( 'parse_query', 'fix_topic_query' );

function fix_topic_query( $query ) {
    if ( empty( $query->query_vars['topic'] ) )

    $query->is_singular = true;
    $query->is_single   = true;
    $query->is_home     = false;

#2 @MZAWeb
11 years ago

  • Keywords 2nd-opinion removed
  • Resolution set to invalid
  • Status changed from new to closed

Sorry, ignore. Need to debug this a bit more before reporting.

#3 @alexvorn2
11 years ago

  • Milestone Awaiting Review deleted
Note: See TracTickets for help on using tickets.