WordPress.org

Make WordPress Core

Ticket #16347: 16347.2.diff

File 16347.2.diff, 596 bytes (added by blt4, 7 years ago)

How about this (replace $wp_query with $this, and post_type with name).

  • wp-includes/query.php

     
    29662966                if ( empty( $post_types ) || !$this->is_post_type_archive )
    29672967                        return (bool) $this->is_post_type_archive;
    29682968
    2969                 if ( ! isset( $this->posts[0] ) )
    2970                         return false;
     2969                $post_type_object = $this->get_queried_object();
    29712970
    2972                 $post = $this->posts[0];
    2973 
    2974                 return in_array( $post->post_type, (array) $post_types );
     2971                return in_array( $post_type_object->name, (array) $post_types );
    29752972        }
    29762973
    29772974        /**