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. Props alexandrebuffet, ankitkumarshah, gaambo, jorbin, karthickmurugan, oglekler, poena, sukhendu2002. Fixes #62523. Built from https://develop.svn.wordpress.org/trunk@59742 git-svn-id: http://core.svn.wordpress.org/trunk@59084 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -50,7 +50,7 @@ final class WP_Block_Templates_Registry {
|
||||
} elseif ( preg_match( '/[A-Z]+/', $template_name ) ) {
|
||||
$error_message = __( 'Template names must not contain uppercase characters.' );
|
||||
$error_code = 'template_name_no_uppercase';
|
||||
} elseif ( ! preg_match( '/^[a-z0-9-]+\/\/[a-z0-9-]+$/', $template_name ) ) {
|
||||
} elseif ( ! preg_match( '/^[a-z0-9_\-]+\/\/[a-z0-9_\-]+$/', $template_name ) ) {
|
||||
$error_message = __( 'Template names must contain a namespace prefix. Example: my-plugin//my-custom-template' );
|
||||
$error_code = 'template_no_prefix';
|
||||
} elseif ( $this->is_registered( $template_name ) ) {
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '6.8-alpha-59740';
|
||||
$wp_version = '6.8-alpha-59742';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
||||
Reference in New Issue
Block a user