diff --git a/src/wp-includes/sitemaps/class-wp-sitemaps-registry.php b/src/wp-includes/sitemaps/class-wp-sitemaps-registry.php
index 5cb2e2fa45..6edf1dfe5c 100644
--- a/src/wp-includes/sitemaps/class-wp-sitemaps-registry.php
+++ b/src/wp-includes/sitemaps/class-wp-sitemaps-registry.php
@@ -65,7 +65,7 @@ class WP_Sitemaps_Registry {
 	 * @return WP_Sitemaps_Provider|null Sitemap provider if it exists, null otherwise.
 	 */
 	public function get_provider( $name ) {
-		if ( ! isset( $this->providers[ $name ] ) ) {
+		if ( ! is_string( $name ) || ! isset( $this->providers[ $name ] ) ) {
 			return null;
 		}
 
diff --git a/src/wp-includes/taxonomy.php b/src/wp-includes/taxonomy.php
index 698a0699cc..f1433b20bc 100644
--- a/src/wp-includes/taxonomy.php
+++ b/src/wp-includes/taxonomy.php
@@ -337,7 +337,7 @@ function get_taxonomy( $taxonomy ) {
 function taxonomy_exists( $taxonomy ) {
 	global $wp_taxonomies;
 
-	return isset( $wp_taxonomies[ $taxonomy ] );
+	return is_string( $taxonomy ) && isset( $wp_taxonomies[ $taxonomy ] );
 }
 
 /**
