Custom Fields
Re-Envisioned
Support MB Blocks MB Blocks with allowed_block_types

  • Creator
    Topic
  • #17702
    Resolved epac
    Participant

    Hi
    I use this function to remove some default block. Is there a way to add my custom blocks into the filtered list ? I’ve tried to add the id block, but it doesn’t work.
    Many thanks

    function my_plugin_allowed_block_types( $allowed_block_types, $post ) {
    return array(
    ‘core/image’,
    ‘core/paragraph’,
    ‘core/heading’,
    ‘core/list’,
    ‘core/button’,
    ‘core/video’,
    ‘core/file’,
    ‘core/button’,
    ‘core/columns’,
    );
    }

    add_filter( ‘allowed_block_types’, ‘my_plugin_allowed_block_types’, 10, 2 );

Viewing 1 replies (of 1 total)
  • Author
    Replies
  • #17714
    Anh Tran
    Keymaster

    Hi,

    Each block registered with MB Blocks has an unique ID of meta-box/{$id}. So you can use it to add to your filter list.

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