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
This commit is contained in:
parent
4d7b989116
commit
f27a713d56
|
@ -309,6 +309,7 @@ function is_taxonomy_hierarchical($taxonomy) {
|
||||||
* @param string $taxonomy Name of taxonomy object
|
* @param string $taxonomy Name of taxonomy object
|
||||||
* @param array|string $object_type Name of the object type for the 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.
|
* @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() ) {
|
function register_taxonomy( $taxonomy, $object_type, $args = array() ) {
|
||||||
global $wp_taxonomies, $wp;
|
global $wp_taxonomies, $wp;
|
||||||
|
@ -330,6 +331,9 @@ function register_taxonomy( $taxonomy, $object_type, $args = array() ) {
|
||||||
);
|
);
|
||||||
$args = wp_parse_args($args, $defaults);
|
$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 ( false !== $args['query_var'] && !empty($wp) ) {
|
||||||
if ( true === $args['query_var'] )
|
if ( true === $args['query_var'] )
|
||||||
$args['query_var'] = $taxonomy;
|
$args['query_var'] = $taxonomy;
|
||||||
|
|
Loading…
Reference in New Issue