Filter hook 'allowed_block_types_all'

in WP Core File wp-includes/block-editor.php at line 127

View Source

allowed_block_types_all

Filter Hook
Description
Filters the allowed block types for all editor types.

Hook Information

File Location wp-includes/block-editor.php View on GitHub
Hook Type Filter
Line Number 127

Hook Parameters

Type Name Description
bool|string[] $allowed_block_types Array of block type slugs, or boolean to enable/disable all. Default true (all registered block types supported).
WP_Block_Editor_Context $block_editor_context The current block editor context.

Usage Examples

Basic Usage
<?php
// Hook into allowed_block_types_all
add_filter('allowed_block_types_all', 'my_custom_filter', 10, 2);

function my_custom_filter($allowed_block_types, $block_editor_context) {
    // Your custom filtering logic here
    return $allowed_block_types;
}

Source Code Context

wp-includes/block-editor.php:127 - How this hook is used in WordPress core
<?php
 122  	 *
 123  	 * @param bool|string[]           $allowed_block_types  Array of block type slugs, or boolean to enable/disable all.
 124  	 *                                                      Default true (all registered block types supported).
 125  	 * @param WP_Block_Editor_Context $block_editor_context The current block editor context.
 126  	 */
 127  	$allowed_block_types = apply_filters( 'allowed_block_types_all', $allowed_block_types, $block_editor_context );
 128  
 129  	if ( ! empty( $block_editor_context->post ) ) {
 130  		$post = $block_editor_context->post;
 131  
 132  		/**

PHP Documentation

<?php
/**
	 * Filters the allowed block types for all editor types.
	 *
	 * @since 5.8.0
	 *
	 * @param bool|string[]           $allowed_block_types  Array of block type slugs, or boolean to enable/disable all.
	 *                                                      Default true (all registered block types supported).
	 * @param WP_Block_Editor_Context $block_editor_context The current block editor context.
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 2
  • File: wp-includes/block-editor.php
Related Hooks

Related hooks will be displayed here in future updates.