mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-07-04 17:20:07 +00:00
Query: Prevent PHP notice when get_post_type_object() returns null in is_post_type_archive().
This changeset avoids potential PHP notices caused by `get_post_type_object()` returning `null` when called inside `is_post_type_archive()`. Props sean212, costdev. Fixes #56287. git-svn-id: https://develop.svn.wordpress.org/trunk@54464 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -3935,6 +3935,10 @@ class WP_Query {
|
||||
}
|
||||
$post_type_object = get_post_type_object( $post_type );
|
||||
|
||||
if ( ! $post_type_object ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return in_array( $post_type_object->name, (array) $post_types, true );
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user