Hi there,
I am using this wordpress hook 'allowed_block_types_all' to allow certain block types in the editor .
I want to disable most of the wordpress & Toolset built-in blocks and add in my custom wp blocks.
I want to only keep the toolset view block (screenshot attached), what is the format to add/keep the toolset view block to my function?
I know for built-in core blocks, it's using this format:
'core/paragraph'
'core/heading'
For my custom wp blocks, I'm using ACF pro plugin, so the format is like below:
'acf/sp-single-button'
For toolset, what is the format?
below is my code to allow certain blocks:
add_filter( 'allowed_block_types_all', 'sp_allowed_block_types', 10, 2 );
function sp_allowed_block_types( $allowed_blocks ) {
return array(
'core/paragraph',
'core/block',
'acf/classic-wysiwyg',
'acf/custom-heading',
'acf/sp-multi-buttons',
'acf/sp-row',
'acf/sp-column',
);
}
Thank you!
Hello,
Please try 'toolset-views/view-editor', for example:
add_filter( 'allowed_block_types_all', 'sp_allowed_block_types', 10, 2 );
function sp_allowed_block_types( $allowed_blocks ) {
return array(
'toolset-views/view-editor',
);
}
Thank you Luo! I will give that a try!
If I want to include more of the toolset block to the 'allowed_block_types_all' hook, how can we find the names for each of the toolset blocks?
Thanks again!
There isn't any existed document for it, Toolset Blocks is also using WordPress built-in function register_block_type() to create new Blocks type, so you can search it in Toolset Blocks plugin file using keyword: register_block_type
More help:
https://developer.wordpress.org/reference/functions/register_block_type/
My issue is resolved now. Thank you Luo!