Skip to content
Snippets Groups Projects
Commit 4844bcbe authored by agata's avatar agata
Browse files

blocks allowed test

parent 9c6d7264
No related branches found
No related tags found
No related merge requests found
Pipeline #37469 passed
......@@ -8,18 +8,17 @@
* Author URI: https://autistici.org
**/
function wpdocs_allowed_block_types ( $block_editor_context, $editor_context ) {
if ( ! empty( $editor_context->post ) ) {
return array(
'core/paragraph',
'core/heading',
'core/list',
);
}
function blacklist_blocks( $allowed_blocks ) {
// get all the registered blocks
$blocks = WP_Block_Type_Registry::get_instance()->get_all_registered();
// then disable some of them
unset( $blocks[ 'core/embed' ] );
// return the new list of allowed blocks
return array_keys( $blocks );
return $block_editor_context;
}
add_filter( 'allowed_block_types_all', 'blacklist_blocks' );
add_filter( 'allowed_block_types_all', 'wpdocs_allowed_block_types', 10, 2 );
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment