Make WordPress Core


Ignore:
Timestamp:
02/13/2015 04:42:36 PM (10 years ago)
Author:
johnbillion
Message:

Return a WP_Error if an empty name is provided when registering a post type.

Fixes #31134
Props tyxla, MikeHansenMe

File:
1 edited

Legend:

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

    r31188 r31450  
    13431343    $args->name = $post_type;
    13441344
    1345     if ( strlen( $post_type ) > 20 ) {
    1346         _doing_it_wrong( __FUNCTION__, __( 'Post types cannot exceed 20 characters in length' ), '4.0' );
    1347         return new WP_Error( 'post_type_too_long', __( 'Post types cannot exceed 20 characters in length' ) );
     1345    if ( empty( $post_type ) || strlen( $post_type ) > 20 ) {
     1346        _doing_it_wrong( __FUNCTION__, __( 'Post type names must be between 1 and 20 characters in length.' ), '4.2' );
     1347        return new WP_Error( 'post_type_length_invalid', __( 'Post type names must be between 1 and 20 characters in length.' ) );
    13481348    }
    13491349
Note: See TracChangeset for help on using the changeset viewer.