-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Open
Labels
[Feature] Block DirectoryRelated to the Block Directory, a repository of block pluginsRelated to the Block Directory, a repository of block plugins[Feature] BlocksOverall functionality of blocksOverall functionality of blocks[Feature] ExtensibilityThe ability to extend blocks or the editing experienceThe ability to extend blocks or the editing experience[Type] BugAn existing feature does not function as intendedAn existing feature does not function as intended
Description
Is there an existing issue for this?
- I have searched the existing issues
Have you tried deactivating all plugins except Gutenberg?
- I have tested with all plugins deactivated.
Have you tried replicating the bug using a default theme e.g. Twenty Twenty?
- I have tested with a default theme.
Description
Using the 'allowed_block_types_all'
hook will prevent searching from the Block Directory when searching for blocks.
The reason we are using the 'allowed_block_types_all'
hook is that we want to turn off the block for full site editing, which was added in 5.8.
If it is difficult to solve this problem, I would like to see a hook added that allows you to specify 'disallowed blocks' instead of 'allowed blocks'.
Translated with www.DeepL.com/Translator (free version)
Step-by-step reproduction instructions
- Use the 'allowed_block_types_all' hook to restrict the block. For example, the following
add_filter( 'allowed_block_types_all', 'test__limit_block_types', 99, 2 );
function test__limit_block_types( $allowed_block_types, $block_editor_context ) {
// 全ブロック取得
$all_blocks = [];
$block_types = \WP_Block_Type_Registry::get_instance()->get_all_registered();
foreach ( $block_types as $block_type ) {
$all_blocks[] = $block_type->name;
}
$FSE_blocks = [
'core/loginout',
'core/page-list',
'core/post-content',
'core/post-date',
'core/post-excerpt',
'core/post-featured-image',
'core/post-terms',
'core/post-title',
'core/post-template',
'core/query-loop',
'core/query',
'core/query-pagination',
'core/query-pagination-next',
'core/query-pagination-numbers',
'core/query-pagination-previous',
'core/query-title',
'core/site-logo',
'core/site-title',
'core/site-tagline',
];
$allowed_blocks = array_diff( $all_blocks, $FSE_blocks );
$allowed_blocks = array_values( $allowed_blocks );
return $allowed_blocks;
}
- Search for blocks. For example, "countdown".
Expected Behavior
Current Behavior
Screenshots or screen recording (optional)
No response
Code snippet (optional)
No response
WordPress Information
No response
Gutenberg Information
No response
What browsers are you seeing the problem on?
No response
Device Information
No response
Operating System Information
No response
Metadata
Metadata
Assignees
Labels
[Feature] Block DirectoryRelated to the Block Directory, a repository of block pluginsRelated to the Block Directory, a repository of block plugins[Feature] BlocksOverall functionality of blocksOverall functionality of blocks[Feature] ExtensibilityThe ability to extend blocks or the editing experienceThe ability to extend blocks or the editing experience[Type] BugAn existing feature does not function as intendedAn existing feature does not function as intended