diff --git a/wp-includes/class-wp-query.php b/wp-includes/class-wp-query.php
index 8525987454..e48d942f0c 100644
--- a/wp-includes/class-wp-query.php
+++ b/wp-includes/class-wp-query.php
@@ -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 );
 	}
 
diff --git a/wp-includes/version.php b/wp-includes/version.php
index 1f8b51831d..9ee801c52d 100644
--- a/wp-includes/version.php
+++ b/wp-includes/version.php
@@ -16,7 +16,7 @@
  *
  * @global string $wp_version
  */
-$wp_version = '6.1-beta3-54450';
+$wp_version = '6.1-beta3-54464';
 
 /**
  * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.