allowed_block_types filter-hookWP 5.0.0

Deprecated from version 5.8.0. It is no longer supported and can be removed in future releases. See allowed_block_types_all.

Deprecated: 5.8.0 Use the {@see 'allowed_block_types_all'} filter instead.

Filters the allowed block types for the editor.

Usage

add_filter( 'allowed_block_types', 'wp_kama_allowed_block_types_filter', 10, 3 );

/**
 * Function for `allowed_block_types` filter-hook.
 * 
 * @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_Post       $post                The post resource data.
 * @param               $string              
 *
 * @return bool|string[]
 */
function wp_kama_allowed_block_types_filter( $allowed_block_types, $post, $string ){

	// filter...
	return $allowed_block_types;
}
$allowed_block_types(true|false|string[])
Array of block type slugs, or boolean to enable/disable all. Default true (all registered block types supported)
$post(WP_Post)
The post resource data.
$string
-

Changelog

Since 5.0.0 Introduced.
Deprecated since 5.8.0 Use the {@see 'allowed_block_types_all'} filter instead.

Where the hook is called

get_allowed_block_types()
allowed_block_types
wp-includes/block-editor.php 141
$allowed_block_types = apply_filters_deprecated( 'allowed_block_types', array( $allowed_block_types, $post ), '5.8.0', 'allowed_block_types_all' );

Where the hook is used in WordPress

Usage not found.