Return WP_Error when registering a taxonomy that exceeds 32 characters.
Props ocean90. fixes #21593 git-svn-id: http://core.svn.wordpress.org/trunk@22307 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
076ede55f2
commit
28461df188
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue