Making WordPress.org

Ticket #2836: 2836.patch

File 2836.patch, 1.9 KB (added by SergeyBiryukov, 8 years ago)
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-plugin-directory.php

     
    653653         * @param \WP_Query $wp_query The WordPress Query object.
    654654         */
    655655        public function pre_get_posts( $wp_query ) {
    656                 if ( is_admin() || ! $wp_query->is_main_query() ) {
     656                if ( is_admin() ) {
    657657                        return;
    658658                }
    659659
     
    720720                $viewing_own_author_archive = false;
    721721
    722722                // Author Archives need to be created
    723                 if ( isset( $wp_query->query['author_name'] ) || isset( $wp_query->query['author'] ) ) {
    724                         $user = isset( $wp_query->query['author_name'] ) ? $wp_query->query['author_name'] : (get_user_by( 'id', $wp_query->query['author'])->user_nicename);
     723                if ( $wp_query->is_main_query() && ( isset( $wp_query->query['author_name'] ) || isset( $wp_query->query['author'] ) ) ) {
     724                        $user = isset( $wp_query->query['author_name'] ) ? $wp_query->query['author_name'] : get_user_by( 'id', $wp_query->query['author'] )->user_nicename;
    725725
    726726                        $viewing_own_author_archive = is_user_logged_in() && ( current_user_can( 'plugin_review' ) || 0 === strcasecmp( $user, wp_get_current_user()->user_nicename ) );
    727727
     
    756756                }
    757757
    758758                // For singular requests, or self-author profile requests allow restricted post_status items to show on the front-end.
    759                 if ( $viewing_own_author_archive || ( is_user_logged_in() && !empty( $wp_query->query_vars['name'] ) ) ) {
     759                if ( $wp_query->is_main_query() && ( $viewing_own_author_archive || is_user_logged_in() && !empty( $wp_query->query_vars['name'] ) ) ) {
    760760
    761761                        $wp_query->query_vars['post_status'] = array( 'approved', 'publish', 'closed', 'disabled' );
    762762