• Resolved cosmocanuck

    (@cosmocanuck)


    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)
  • Plugin Support Alex

    (@fellan91)

    Hello,

    Here is the slug of our block: nk/awb
    Based on the code block above, we can simply add our slug to the default array, like this:

    $default = array(
    'core/cover',
    'core/gallery',
    'core/video',
    'nk/awb',
    );

    However, this solution may not work if there are other filters or restrictions in place. I recommend consulting with an expert to modify the project code properly. Unfortunately, we don’t provide such services.

    Regards,
    Alex

    Thread Starter cosmocanuck

    (@cosmocanuck)

    Thanks Alex, this is super helpful! ????

    Adam

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.