From f27a713d5625d81d372062178ef3e35fcc402283 Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Thu, 25 Oct 2012 22:12:02 +0000 Subject: [PATCH] Return WP_Error when registering a taxonomy that exceeds 32 characters. Props ocean90. fixes #21593 git-svn-id: https://develop.svn.wordpress.org/trunk@22307 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/taxonomy.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/wp-includes/taxonomy.php b/wp-includes/taxonomy.php index 921a5d97e4..861c625a56 100644 --- a/wp-includes/taxonomy.php +++ b/wp-includes/taxonomy.php @@ -309,6 +309,7 @@ function is_taxonomy_hierarchical($taxonomy) { * @param string $taxonomy Name of taxonomy object * @param array|string $object_type Name of the object type for the taxonomy object. * @param array|string $args See above description for the two keys values. + * @return null|WP_Error WP_Erorr if errors, otherwise null. */ function register_taxonomy( $taxonomy, $object_type, $args = array() ) { global $wp_taxonomies, $wp; @@ -330,6 +331,9 @@ function register_taxonomy( $taxonomy, $object_type, $args = array() ) { ); $args = wp_parse_args($args, $defaults); + if ( strlen( $taxonomy ) > 32 ) + return new WP_Error( 'taxonomy_too_long', __( 'Taxonomies cannot exceed 32 characters in length' ) ); + if ( false !== $args['query_var'] && !empty($wp) ) { if ( true === $args['query_var'] ) $args['query_var'] = $taxonomy;