WordPress.org

Make WordPress Core

Changeset 16650


Ignore:
Timestamp:
12/01/10 17:13:31 (4 years ago)
Author:
markjaquith
Message:

Throw WP_Error if post_type passed to register_post_type() is longer than schema allows. props phrostypoison. fixes #13709

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3.0/wp-includes/post.php

    r15406 r16650  
    801801 * @param string $post_type Name of the post type. 
    802802 * @param array|string $args See above description. 
    803  * @return object the registered post type object 
     803 * @return object|WP_Error the registered post type object, or an error object 
    804804 */ 
    805805function register_post_type($post_type, $args = array()) { 
     
    822822    $post_type = sanitize_user($post_type, true); 
    823823    $args->name = $post_type; 
     824 
     825    if ( strlen( $post_type ) > 20 ) 
     826            return new WP_Error( 'post_type_too_long', __( 'Post types cannot exceed 20 characters in length' ) ); 
    824827 
    825828    // If not set, default to the setting for public. 
Note: See TracChangeset for help on using the changeset viewer.