WordPress.org

Make WordPress Core

Changeset 17358


Ignore:
Timestamp:
01/24/2011 09:15:50 PM (7 years ago)
Author:
markjaquith
Message:

Get is_post_type_archive( 'my-post-type' ) working properly outside of the loop. props bit4. fixes #16347

File:
1 edited

Legend:

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

    r17272 r17358  
    29672967            return (bool) $this->is_post_type_archive;
    29682968
    2969         if ( ! isset( $this->posts[0] ) )
    2970             return false;
    2971 
    2972         $post = $this->posts[0];
    2973 
    2974         return in_array( $post->post_type, (array) $post_types );
     2969        $post_type_object = $this->get_queried_object();
     2970
     2971        return in_array( $post_type_object->name, (array) $post_types );
    29752972    }
    29762973
Note: See TracChangeset for help on using the changeset viewer.