[wp-trac] [WordPress Trac] #56627: Underscores are not allowed in block names; error message is misleading.

WordPress Trac noreply at wordpress.org
Thu Sep 22 17:11:45 UTC 2022


#56627: Underscores are not allowed in block names; error message is misleading.
--------------------------+-----------------------------
 Reporter:  skorasaurus   |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Editor        |    Version:  trunk
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 The error when activating a plugin containing a register block whose name
 contains an underscore is vague and misleading.

 If you do not have WP_DEBUG set to true in your site's wp-config.php file;
 there are no errors in the browser's javascript console while in the
 editor.

 When you have WP_DEBUG set to true; and activate the plugin that contains
 the block, the error message displayed is misleading; the message,
 included verbatim below, states that a namespace prefix must be used and
 in my test case block, a name space was used; create-block

 {{{
 "Notice: Function WP_Block_Type_Registry::register was called
 <strong>incorrectly</strong>. Block type names must contain a namespace
 prefix. Example: my-plugin/my-custom-block-type Please see <a
 href="https://wordpress.org/support/article/debugging-in-
 wordpress/">Debugging in WordPress</a> for more information. (This message
 was added in version 5.0.0.) in /srv/www/case/public_html/wp-
 includes/functions.php on line 5831"
 }}}


 A testcase for a block named 'my_test_case' is available at
 https://gitlab.com/skorasaurus/my_test_case
 The block does has a namespace, create-block.


 The full stacktrace for the error is at
 https://gist.github.com/skorasaurus/6506770a49bedff53876b962c1d29b16


 This has happened to me in the past, has been reported in the [gutenberg
 issue tracker]https://github.com/WordPress/gutenberg/issues/13074 (issue
 was closed and directed to report here)

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/56627>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list