[wp-trac] [WordPress Trac] #62523: Can't register Block Templates for CPTs with an underscore "_" character in the key

WordPress Trac noreply at wordpress.org
Thu Jan 30 22:30:30 UTC 2025


#62523: Can't register Block Templates for CPTs with an underscore "_" character in
the key
-------------------------------------------------+-------------------------
 Reporter:  alexandrebuffet                      |       Owner:  flixos90
     Type:  defect (bug)                         |      Status:  closed
 Priority:  normal                               |   Milestone:  6.7.2
Component:  Editor                               |     Version:  6.7
 Severity:  normal                               |  Resolution:  fixed
 Keywords:  has-patch has-testing-info has-      |     Focuses:  template
  unit-tests dev-reviewed fixed-major            |
-------------------------------------------------+-------------------------
Changes (by flixos90):

 * status:  reopened => closed
 * resolution:   => fixed


Comment:

 In [changeset:"59743" 59743]:
 {{{
 #!CommitTicketReference repository="" revision="59743"
 Editor: Fix block template registration failing for custom post types
 containing underscore characters.

 Custom post types may contain underscores, however block template
 registration has been using a regular expression that disallows
 underscores. Since the block template name for certain templates is
 directly associated with which post type it applies to, this regular
 expression was causing unexpected failures. This changeset adjusts the
 regular expression to allow block template names with underscore
 characters, effectively allowing block templates to be registered for any
 custom post type.

 Reviewed by jorbin.
 Merges [59742] to the 6.7 branch.

 Props alexandrebuffet, ankitkumarshah, gaambo, jorbin, karthickmurugan,
 oglekler, poena, sukhendu2002.
 Fixes #62523.
 }}}

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


More information about the wp-trac mailing list