Taxonomy: Prevent non string taxonomy names generating warnings or errors.

This changeset adds an `is_string( $taxonomy )` check to the condition in `taxonomy_exists()`, to ensure `false` is returned when the `$taxonomy` is not a string.

Follow-up to [35718].

Props costdev, peterwilsoncc, mukesh27.
Fixes #56338.
See #56336.

Built from https://develop.svn.wordpress.org/trunk@53869


git-svn-id: http://core.svn.wordpress.org/trunk@53428 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
audrasjb 2022-08-09 10:23:13 +00:00
parent f627535216
commit f63d34e3e3
2 changed files with 2 additions and 2 deletions

View File

@ -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 ] );
}
/**

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.1-alpha-53868';
$wp_version = '6.1-alpha-53869';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.