Remove post_type params from is_archive(). use is_post_type_archive() for full context. see #13818.
git-svn-id: https://develop.svn.wordpress.org/trunk@15937 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
6d7366d5fc
commit
6eb9fbbd39
|
@ -859,7 +859,7 @@ function get_post_types( $args = array(), $output = 'names', $operator = 'and' )
|
|||
* - labels - An array of labels for this post type. By default post labels are used for non-hierarchical
|
||||
* types and page labels for hierarchical ones. You can see accepted values in {@link get_post_type_labels()}.
|
||||
* - permalink_epmask - The default rewrite endpoint bitmasks.
|
||||
* - has_archive - Whether to have a post type archive. Will generate the proper rewrite rules if rewrite is enabled.
|
||||
* - has_archive - True to enable post type archives. Will generate the proper rewrite rules if rewrite is enabled.
|
||||
* - rewrite - false to prevent rewrite. Defaults to true. Use array('slug'=>$slug) to customize permastruct;
|
||||
* default will use $post_type as slug. Other options include 'with_front' and 'feeds'.
|
||||
* - query_var - false to prevent queries, or string to value of the query var to use for this post type
|
||||
|
|
|
@ -100,18 +100,12 @@ function wp_reset_postdata() {
|
|||
/**
|
||||
* Is the query for an archive page?
|
||||
*
|
||||
* Month, Year, Category, Author, ...
|
||||
*
|
||||
* If the $post_types parameter is specified, this function will additionally
|
||||
* check if the query is for exactly one of the post types specified. If a plugin
|
||||
* is causing multiple post types to appear in the query, specifying a post type
|
||||
* will cause this check to return false.
|
||||
* Month, Year, Category, Author, Post Type archive...
|
||||
*
|
||||
* @see WP_Query::is_archive()
|
||||
* @since 1.5.0
|
||||
* @uses $wp_query
|
||||
*
|
||||
* @param mixed $post_types Optional. Post type or array of post types
|
||||
* @return bool
|
||||
*/
|
||||
function is_archive( $post_types = '' ) {
|
||||
|
@ -2644,28 +2638,14 @@ class WP_Query extends WP_Object_Query {
|
|||
/**
|
||||
* Is the query for an archive page?
|
||||
*
|
||||
* Month, Year, Category, Author, ...
|
||||
*
|
||||
* If the $post_types parameter is specified, this function will additionally
|
||||
* check if the query is for exactly one of the post types specified. If a plugin
|
||||
* is causing multiple post types to appear in the query, specifying a post type
|
||||
* will cause this check to return false.
|
||||
* Month, Year, Category, Author, Post Type archive...
|
||||
*
|
||||
* @since 3.1.0
|
||||
*
|
||||
* @param mixed $post_types Optional. Post type or array of post types
|
||||
* @return bool
|
||||
*/
|
||||
function is_archive( $post_types ) {
|
||||
if ( empty( $post_types ) || !$this->is_archive )
|
||||
return (bool) $this->is_archive;
|
||||
|
||||
if ( ! isset( $this->posts[0] ) )
|
||||
return false;
|
||||
|
||||
$post = $this->posts[0];
|
||||
|
||||
return in_array( $post->post_type, (array) $post_types );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue