Make WordPress Core

Changeset 28902


Ignore:
Timestamp:
06/29/2014 09:53:35 PM (11 years ago)
Author:
SergeyBiryukov
Message:

Notify developers when register_post_type() or register_taxonomy() fails because of post type or taxonomy key length.

props mattheweppelsheimer.
fixes #28683.

Location:
trunk/src/wp-includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/post.php

    r28875 r28902  
    12441244    $args->name = $post_type;
    12451245
    1246     if ( strlen( $post_type ) > 20 )
     1246    if ( strlen( $post_type ) > 20 ) {
     1247        _doing_it_wrong( __FUNCTION__, __( 'Post types cannot exceed 20 characters in length' ), '4.0' );
    12471248        return new WP_Error( 'post_type_too_long', __( 'Post types cannot exceed 20 characters in length' ) );
     1249    }
    12481250
    12491251    // If not set, default to the setting for public.
  • trunk/src/wp-includes/taxonomy.php

    r28753 r28902  
    347347    $args = wp_parse_args( $args, $defaults );
    348348
    349     if ( strlen( $taxonomy ) > 32 )
     349    if ( strlen( $taxonomy ) > 32 ) {
     350        _doing_it_wrong( __FUNCTION__, __( 'Taxonomies cannot exceed 32 characters in length' ), '4.0' );
    350351        return new WP_Error( 'taxonomy_too_long', __( 'Taxonomies cannot exceed 32 characters in length' ) );
     352    }
    351353
    352354    if ( false !== $args['query_var'] && ! empty( $wp ) ) {
Note: See TracChangeset for help on using the changeset viewer.