Need to enable this block via PHP
-
Hi! I’m working on a site (not coded by me) which uses a function to enable only customized blocks created for the theme with ACF, but I’ve also been able to add back some core blocks, by adding their block slugs, as seen below.
But how do I get the “Background (AWB)” block to show up too? What is its block slug? Or is that even how this would be done?
Thanks!
function gutenburg_allowed_blocks( $allowed_blocks ) {
$default = array(
'core/cover',
'core/gallery',
'core/video'
);
$acf_blocks = gutenburg_block_list();
foreach ( $acf_blocks as $acf_block ) {
$acf_array[] = 'acf/' . $acf_block['name'];
}
$blocks = array_merge($default, $acf_array);
return $blocks;
}
add_filter( 'allowed_block_types', __NAMESPACE__ . '\\gutenburg_allowed_blocks' );
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- You must be logged in to reply to this topic.