• Resolved norico

    (@norico)


    Hello,
    I would like to understand why, when I use the “allowed_block_types_all” filter, some of the plugin’s blocks are deleted.

Viewing 9 replies - 1 through 9 (of 9 total)
  • Hi @norico,

    Thank you for getting in touch with us.

    The filter you mentioned belongs to the core WordPress, they can guide you better about its usage. However, I have searched a article for you that may help you: https://developer.ww.wp.xz.cn/reference/hooks/allowed_block_types_all/

    Have a nice day!

    Thread Starter norico

    (@norico)

    add_filter( 'allowed_block_types_all', 'wpdocs_allowed_post_type_blocks', 10, 2 );

    function wpdocs_allowed_post_type_blocks( $allowed_block_types, $editor_context ) {
    $blocks_to_disable = array(
    'core/code',
    );

    if ( true === $allowed_block_types ) {
    $allowed_block_types = WP_Block_Type_Registry::get_instance()->get_all_registered();
    }
    return array_diff( array_keys( $allowed_block_types ), $blocks_to_disable );
    }

    some blocks was deleted

    Hi @norico,

    Could you please clarify the reason for using the filter? Additionally, can you confirm if you are experiencing issues only with the Spectra blocks?

    Looking forward to hearing from you.

    Have a nice day!

    Thread Starter norico

    (@norico)

    when I use this function to delete embedded content blocks, I lose all the blocks in the plugin.
    I’m on a new installation of wordpress, with no plugin, and the default theme.


    Hi @norico,

    Sorry for the inconvenience caused to you.

    WordPress already provide an option to hide the blocks. Which is in three dot Option beside the publish button in editor > Preferences > Blocks > Manage block visibility

    You can use above settings if you want to hide any specific block from editor. However, code part comes under customization.

    Have a nice day!

    Thread Starter norico

    (@norico)

    I’m sorry, but if I use block masking through PHP, it’s because I can’t do otherwise.

    My users are novices, I can’t give them this solution.

    I don’t understand why it only does this with your blocks.

    Hello,

    I have exactly the same problem.
    Can you help me?

    Best regards,

    Hi @norico , @nidalee97 ,

    Sorry for the inconvenience caused to you.

    I am afraid we can’t help with the custom code as it is out of support scope. You can use the solution shared by me above.

    Have a nice day!

    Thread Starter norico

    (@norico)

    Nice support 😳

    ty

Viewing 9 replies - 1 through 9 (of 9 total)

The topic ‘Allowed block types support’ is closed to new replies.