Make WordPress Core

Changeset 22307


Ignore:
Timestamp:
10/25/2012 10:12:02 PM (13 years ago)
Author:
ryan
Message:

Return WP_Error when registering a taxonomy that exceeds 32 characters.

Props ocean90.
fixes #21593

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/taxonomy.php

    r22118 r22307  
    310310 * @param array|string $object_type Name of the object type for the taxonomy object.
    311311 * @param array|string $args See above description for the two keys values.
     312 * @return null|WP_Error WP_Erorr if errors, otherwise null.
    312313 */
    313314function register_taxonomy( $taxonomy, $object_type, $args = array() ) {
     
    330331                    );
    331332    $args = wp_parse_args($args, $defaults);
     333
     334    if ( strlen( $taxonomy ) > 32 )
     335        return new WP_Error( 'taxonomy_too_long', __( 'Taxonomies cannot exceed 32 characters in length' ) );
    332336
    333337    if ( false !== $args['query_var'] && !empty($wp) ) {
Note: See TracChangeset for help on using the changeset viewer.