Return a `WP_Error` if an empty name is provided when registering a taxonomy.

Fixes #31135
Props tyxla, MikeHansenMe

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


git-svn-id: http://core.svn.wordpress.org/trunk@31430 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
John Blackbourn 2015-02-13 16:27:26 +00:00
parent 7e71b1f827
commit 948f657ea3
2 changed files with 4 additions and 4 deletions

View File

@ -345,9 +345,9 @@ function register_taxonomy( $taxonomy, $object_type, $args = array() ) {
);
$args = wp_parse_args( $args, $defaults );
if ( strlen( $taxonomy ) > 32 ) {
_doing_it_wrong( __FUNCTION__, __( 'Taxonomies cannot exceed 32 characters in length' ), '4.0' );
return new WP_Error( 'taxonomy_too_long', __( 'Taxonomies cannot exceed 32 characters in length' ) );
if ( empty( $taxonomy ) || strlen( $taxonomy ) > 32 ) {
_doing_it_wrong( __FUNCTION__, __( 'Taxonomy names must be between 1 and 32 characters in length.' ), '4.2' );
return new WP_Error( 'taxonomy_length_invalid', __( 'Taxonomy names must be between 1 and 32 characters in length.' ) );
}
if ( false !== $args['query_var'] && ! empty( $wp ) ) {

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.2-alpha-31448';
$wp_version = '4.2-alpha-31449';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.