Add Genesis Block to allowed_block_types
-
I am trying to show only the blocks I really need in my template using allowed_block_types in my functions.php.
I’m not sure how to enter the path to my Genesis Block, which is located in my theme folder (themes/theme_name/blocks/my-block.php)The default blocks are all relative to core. So how do I enter the path to my block?
add_filter( ‘allowed_block_types’, ‘my_allowed_block_types’, 10, 2 );
function my_allowed_block_types( $allowed_blocks, $post ) {$allowed_blocks = array(
‘core/paragraph’,
‘core/heading’,
‘core/list’,
‘core/image’,
‘wp-content/themes/theme_name/blocks/my-block’ //not working
);
return $allowed_blocks;}
- The topic ‘Add Genesis Block to allowed_block_types’ is closed to new replies.