Changeset 31450
- Timestamp:
- 02/13/2015 04:42:36 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/post.php
r31188 r31450 1343 1343 $args->name = $post_type; 1344 1344 1345 if ( strlen( $post_type ) > 20 ) {1346 _doing_it_wrong( __FUNCTION__, __( 'Post type s 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.' ) ); 1348 1348 } 1349 1349 -
trunk/tests/phpunit/tests/post/types.php
r25002 r31450 18 18 19 19 _unregister_post_type( 'foo' ); 20 } 21 22 /** 23 * @ticket 31134 24 * 25 * @expectedIncorrectUsage register_post_type 26 */ 27 function test_register_post_type_length_long() { 28 // post type too long 29 $this->assertInstanceOf( 'WP_Error', register_post_type( 'abcdefghijklmnopqrstuvwxyz0123456789' ) ); 30 } 31 32 /** 33 * @ticket 31134 34 * 35 * @expectedIncorrectUsage register_post_type 36 */ 37 function test_register_post_type_length_short() { 38 // post type too short 39 $this->assertInstanceOf( 'WP_Error', register_post_type( '' ) ); 20 40 } 21 41
Note: See TracChangeset
for help on using the changeset viewer.