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.


git-svn-id: https://develop.svn.wordpress.org/trunk@53869 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Jb Audras
2022-08-09 10:21:32 +00:00
parent 11cc06cd22
commit 60493f3968
2 changed files with 36 additions and 1 deletions
+1 -1
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 ] );
}
/**