Make WordPress Core

Changeset 16670


Ignore:
Timestamp:
12/01/2010 08:43:39 PM (14 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
  • trunk/wp-includes/post.php

    r16667 r16670  
    885885 * @param string $post_type Name of the post type.
    886886 * @param array|string $args See above description.
    887  * @return object the registered post type object
     887 * @return object|WP_Error the registered post type object, or an error object
    888888 */
    889889function register_post_type($post_type, $args = array()) {
     
    908908    $post_type = sanitize_key($post_type);
    909909    $args->name = $post_type;
     910
     911    if ( strlen( $post_type ) > 20 )
     912            return new WP_Error( 'post_type_too_long', __( 'Post types cannot exceed 20 characters in length' ) );
    910913
    911914    // If not set, default to the setting for public.
Note: See TracChangeset for help on using the changeset viewer.