[wp-trac] [WordPress Trac] #54070: Increase CPT "machine name" limit from its current maximum of 20 characters.

WordPress Trac noreply at wordpress.org
Mon Sep 6 01:50:38 UTC 2021


#54070: Increase CPT "machine name" limit from its current maximum of 20
characters.
------------------------------------------------+--------------------------
 Reporter:  taupecat                            |       Owner:  (none)
     Type:  feature request                     |      Status:  new
 Priority:  normal                              |   Milestone:  Awaiting
                                                |  Review
Component:  Database                            |     Version:  trunk
 Severity:  normal                              |  Resolution:
 Keywords:  dev-feedback needs-codex has-patch  |     Focuses:  coding-
                                                |  standards
------------------------------------------------+--------------------------

Comment (by costdev):

 I was looking into this but you got there before me @SergeyBiryukov!

 The test that checks for a post type name that's too long doesn't provide
 a sample that is long enough for this change.

 The test passes with this fix:

 {{{#!php
 tests/phpunit/tests/post/types.php:54

 function test_register_post_type_with_too_long_name() {
         // Post type too long.
         $this->assertInstanceOf( 'WP_Error', register_post_type(
 'abcdefghijklmnopqrstuvwxyz0123456789' ) );
 }
 }}}
 becomes:
 {{{#!php
 function test_register_post_type_with_too_long_name() {
         // Post type too long.
         $long_name =
 'abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789';
         $this->assertInstanceOf( 'WP_Error', register_post_type(
 $long_name ) );
 }
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/54070#comment:6>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list