Check the value passed to get_post_type_object(). If it's an array, use the first item. get_query_var( 'post_type' ) can be an array if the query has been altered via filters/actions. There are several places in core that pass the query var. Adds unit tests.

In `template-loader.php`, move `is_post_type_archive()` and `is_tax()` directly below `is_home()`.

See #18614, [25291].



git-svn-id: https://develop.svn.wordpress.org/trunk@25292 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Scott Taylor
2013-09-06 23:38:51 +00:00
parent 48dc7e576b
commit e688f070dc
3 changed files with 38 additions and 2 deletions

View File

@@ -1058,6 +1058,9 @@ function get_post_type( $post = null ) {
function get_post_type_object( $post_type ) {
global $wp_post_types;
if ( is_array( $post_type ) )
$post_type = reset( $post_type );
if ( empty($wp_post_types[$post_type]) )
return null;