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]. Built from https://develop.svn.wordpress.org/trunk@25292 git-svn-id: http://core.svn.wordpress.org/trunk@25256 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
a67d551dac
commit
d7704991b3
|
@ -1058,6 +1058,9 @@ function get_post_type( $post = null ) {
|
||||||
function get_post_type_object( $post_type ) {
|
function get_post_type_object( $post_type ) {
|
||||||
global $wp_post_types;
|
global $wp_post_types;
|
||||||
|
|
||||||
|
if ( is_array( $post_type ) )
|
||||||
|
$post_type = reset( $post_type );
|
||||||
|
|
||||||
if ( empty($wp_post_types[$post_type]) )
|
if ( empty($wp_post_types[$post_type]) )
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
|
|
|
@ -26,10 +26,10 @@ if ( defined('WP_USE_THEMES') && WP_USE_THEMES ) :
|
||||||
$template = false;
|
$template = false;
|
||||||
if ( is_404() && $template = get_404_template() ) :
|
if ( is_404() && $template = get_404_template() ) :
|
||||||
elseif ( is_search() && $template = get_search_template() ) :
|
elseif ( is_search() && $template = get_search_template() ) :
|
||||||
elseif ( is_post_type_archive() && $template = get_post_type_archive_template() ) :
|
|
||||||
elseif ( is_tax() && $template = get_taxonomy_template() ) :
|
|
||||||
elseif ( is_front_page() && $template = get_front_page_template() ) :
|
elseif ( is_front_page() && $template = get_front_page_template() ) :
|
||||||
elseif ( is_home() && $template = get_home_template() ) :
|
elseif ( is_home() && $template = get_home_template() ) :
|
||||||
|
elseif ( is_post_type_archive() && $template = get_post_type_archive_template() ) :
|
||||||
|
elseif ( is_tax() && $template = get_taxonomy_template() ) :
|
||||||
elseif ( is_attachment() && $template = get_attachment_template() ) :
|
elseif ( is_attachment() && $template = get_attachment_template() ) :
|
||||||
remove_filter('the_content', 'prepend_attachment');
|
remove_filter('the_content', 'prepend_attachment');
|
||||||
elseif ( is_single() && $template = get_single_template() ) :
|
elseif ( is_single() && $template = get_single_template() ) :
|
||||||
|
|
Loading…
Reference in New Issue