[wp-trac] [WordPress Trac] #55184: Custom style handle attached to a custom block style is never load even if the block is in the page.

WordPress Trac noreply at wordpress.org
Mon Jul 25 21:23:32 UTC 2022


#55184: Custom style handle attached to a custom block style is never load even if
the block is in the page.
-----------------------------+------------------------------
 Reporter:  alexandrebuffet  |       Owner:  (none)
     Type:  defect (bug)     |      Status:  new
 Priority:  normal           |   Milestone:  Awaiting Review
Component:  Script Loader    |     Version:  5.9
 Severity:  normal           |  Resolution:
 Keywords:                   |     Focuses:
-----------------------------+------------------------------

Comment (by Drivingralle):

 I can confirm the problem persist in WP v6.0.1

 Code to quickly test it:
 {{{
 add_action( 'init', function () {
         wp_register_style( 'my-fancy-quote', get_template_directory_uri()
 . '/my-fancy-quote-style.css' );
         register_block_style(
                 'core/quote',
                 array(
                         'name'         => 'fancy-quote',
                         'label'        => __( 'Fancy Quote', 'textdomain'
 ),
                         'style' => 'my-fancy-quote',
                 )
         );
 } );
 }}}


 The handbook says the parmeter is called "style_handle":
 https://developer.wordpress.org/block-editor/reference-guides/block-api
 /block-styles/

 The core says it's called "style" in some place:
 https://github.com/WordPress/WordPress/blob/master/wp-
 includes/blocks.php#L993
 and "style_handle" in other places:
 https://github.com/WordPress/WordPress/blob/master/wp-includes/class-wp-
 block-styles-registry.php#L41

 Both of them are not working.

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


More information about the wp-trac mailing list