-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Closed
Labels
[Block] ButtonsAffects the Buttons BlockAffects the Buttons Block[Type] EnhancementA suggestion for improvement.A suggestion for improvement.
Description
Description
Variation of core/button block are not available in the core/buttons inserter.
I expect to see the variations when adding button.
Step-by-step reproduction instructions
- Add the code snippet provided below to WordPress
- Create or edit a post
- Add a "Buttons" block
Only the basic block "button" is available, the variations can't be used.
- Open the browser devtools
- In the console, run
wp.blocks.getBlockVariations('core/button');
The two registered variations are correctly listed as a result.
Screenshots, screen recording, code snippet
Small code snippet to demonstrate the issue.
<?php
add_action( 'enqueue_block_editor_assets', function () {
wp_enqueue_script( 'wp-blocks', );
wp_add_inline_script(
'wp-blocks',
"
wp.blocks.registerBlockVariation('core/button', {
name: 'custom-button',
label: 'My custom button',
attributes: {className: 'my-custom-button'},
});
wp.blocks.registerBlockVariation('core/button', {
name: 'custom-button-default',
label: 'My custom button (Default variation)',
attributes: {className: 'my-custom-button-default'},
isDefault: true
});
",
'after'
);
} );Environment info
- WordPress 6.3, Gutenberg 16.4.0, TwentyTwentyThree
- Firefox / Chrome
- Desktop mac 13
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Yes
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
[Block] ButtonsAffects the Buttons BlockAffects the Buttons Block[Type] EnhancementA suggestion for improvement.A suggestion for improvement.
Type
Fields
Give feedbackNo fields configured for issues without a type.