apply_filters( 'allowed_block_types_all', bool|array $allowed_block_types, WP_Block_Editor_Context $block_editor_context )

Filters the allowed block types for all editor types.


Parameters Parameters

$allowed_block_types

(bool|array) Array of block type slugs, or boolean to enable/disable all. Default true (all registered block types supported).

$block_editor_context

(WP_Block_Editor_Context) The current block editor context.


Top ↑

Source Source

File: wp-includes/block-editor.php

View on Trac



Top ↑

Changelog Changelog

Changelog
Version Description
5.8.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

  1. Skip to note 1 content
    Contributed by thejaydip

    Basic Example

    function wpdocs_allowed_block_types ( $block_editor_context, $editor_context ) {
    	if ( ! empty( $editor_context->post ) ) {
    		return array(
    			'core/paragraph',
    			'core/heading',
    			'core/list',
    		);
    	}
    
    	return $block_editor_context;
    }
    
    add_filter( 'allowed_block_types_all', 'wpdocs_allowed_block_types', 10, 2 );

You must log in before being able to contribute a note or feedback.