Making WordPress.org


Ignore:
Timestamp:
03/04/2016 08:20:31 PM (9 years ago)
Author:
obenland
Message:

W.org Themes: Only override post type for the main query.

Fixes a bug where queries for commercial theme shops would be borked because
the wrong post type was set.

See https://wordpress.slack.com/archives/meta/p1457118750001530
See [2680].

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/theme-directory/theme-directory.php

    r2680 r2696  
    905905
    906906/**
    907  * Correct the post type for theme queries to be "repopackage"
     907 * Correct the post type for theme queries to be "repopackage".
    908908 */
    909909function wporg_themes_adjust_main_query( $query ) {
    910     if ( get_query_var('name') && !is_404() ) {
     910    if ( $query->is_main_query() && $query->get( 'name' ) && ! $query->is_404() ) {
    911911        $query->query_vars['post_type'] = 'repopackage';
    912912    }
Note: See TracChangeset for help on using the changeset viewer.