Make WordPress Core

Ticket #62523: 62523-final.patch

File 62523-final.patch, 860 bytes (added by karthickmurugan, 21 months ago)

Thanks @gaambo for the feedback. Updated the patch file with the consistent regex pattern. Tested it and working prefectly.

  • wp-includes/class-wp-block-templates-registry.php

     
    5050                } elseif ( preg_match( '/[A-Z]+/', $template_name ) ) {
    5151                        $error_message = __( 'Template names must not contain uppercase characters.' );
    5252                        $error_code    = 'template_name_no_uppercase';
    53                 } elseif ( ! preg_match( '/^[a-z0-9-]+\/\/[a-z0-9-]+$/', $template_name ) ) {
     53                } elseif ( ! preg_match( '/^[a-z0-9_\-]+\/\/[a-z0-9_\-]+$/', $template_name ) ) {
    5454                        $error_message = __( 'Template names must contain a namespace prefix. Example: my-plugin//my-custom-template' );
    5555                        $error_code    = 'template_no_prefix';
    5656                } elseif ( $this->is_registered( $template_name ) ) {