diff --git a/src/wp-includes/template.php b/src/wp-includes/template.php index 01f9c8a715..cc15eedb48 100644 --- a/src/wp-includes/template.php +++ b/src/wp-includes/template.php @@ -135,8 +135,9 @@ function get_post_type_archive_template() { $post_type = reset( $post_type ); $obj = get_post_type_object( $post_type ); - if ( ! $obj->has_archive ) + if ( ! ( $obj instanceof WP_Post_Type ) || ! $obj->has_archive ) { return ''; + } return get_archive_template(); }