Title: allowed_block_types_all
Published: July 20, 2021
Last modified: April 28, 2025

---

# apply_filters( ‘allowed_block_types_all’, bool|string[] $allowed_block_types, WP_Block_Editor_Context $block_editor_context )

## In this article

 * [Parameters](https://developer.wordpress.org/reference/hooks/allowed_block_types_all/?output_format=md#parameters)
 * [Source](https://developer.wordpress.org/reference/hooks/allowed_block_types_all/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/hooks/allowed_block_types_all/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/hooks/allowed_block_types_all/?output_format=md#changelog)
 * [User Contributed Notes](https://developer.wordpress.org/reference/hooks/allowed_block_types_all/?output_format=md#user-contributed-notes)

[ Back to top](https://developer.wordpress.org/reference/hooks/allowed_block_types_all/?output_format=md#wp--skip-link--target)

Filters the allowed block types for all editor types.

## 󠀁[Parameters](https://developer.wordpress.org/reference/hooks/allowed_block_types_all/?output_format=md#parameters)󠁿

 `$allowed_block_types`bool|string[]

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](https://developer.wordpress.org/reference/classes/wp_block_editor_context/)

The current block editor context.

## 󠀁[Source](https://developer.wordpress.org/reference/hooks/allowed_block_types_all/?output_format=md#source)󠁿

    ```php
    $allowed_block_types = apply_filters( 'allowed_block_types_all', $allowed_block_types, $block_editor_context );
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/block-editor.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-includes/block-editor.php#L127)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/block-editor.php#L127-L127)

## 󠀁[Related](https://developer.wordpress.org/reference/hooks/allowed_block_types_all/?output_format=md#related)󠁿

| Used by | Description | 
| [get_allowed_block_types()](https://developer.wordpress.org/reference/functions/get_allowed_block_types/)`wp-includes/block-editor.php` |

Gets the list of allowed block types to use in the block editor.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/hooks/allowed_block_types_all/?output_format=md#changelog)󠁿

| Version | Description | 
| [5.8.0](https://developer.wordpress.org/reference/since/5.8.0/) | Introduced. |

## 󠀁[User Contributed Notes](https://developer.wordpress.org/reference/hooks/allowed_block_types_all/?output_format=md#user-contributed-notes)󠁿

 1.   [Skip to note 4 content](https://developer.wordpress.org/reference/hooks/allowed_block_types_all/?output_format=md#comment-content-5624)
 2.    [Matt Calvert](https://profiles.wordpress.org/xandercalvert/)  [  4 years ago  ](https://developer.wordpress.org/reference/hooks/allowed_block_types_all/#comment-5624)
 3.  [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fallowed_block_types_all%2F%23comment-5624)
     Vote results for this note: 4[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fallowed_block_types_all%2F%23comment-5624)
 4.  How it can be used to filter for multiple post types in the same function. This
     filters the custom post types of ‘sponsors’, ‘news’ and ‘faqs’ to only allow the
     core Gutenberg blocks listed.
 5.      ```php
         function wpdocs_allowed_post_type_blocks( $allowed_block_types, $editor_context ) {
         	if ( 'sponsors' === $editor_context->post->post_type ) {
         		return array(
         			'core/paragraph',
         		);
         	}
     
         	if ( 'news' === $editor_context->post->post_type ) {
         		return array(
         			'core/paragraph',
         			'core/list',
         			'core/image',
         			'core/buttons',
         			'core/quote',
         		);
         	}
     
         	if ( 'faqs' === $editor_context->post->post_type ) {
         		return array(
         			'core/paragraph',
         			'core/list',
         			'core/image',
         			'core/buttons',
         		);
         	}
     
         	return $allowed_block_types;
         }
     
         add_filter( 'allowed_block_types_all', 'wpdocs_allowed_post_type_blocks', 10, 2 );
         ```
     
 6.   [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fallowed_block_types_all%2F%3Freplytocom%3D5624%23feedback-editor-5624)
 7.   [Skip to note 5 content](https://developer.wordpress.org/reference/hooks/allowed_block_types_all/?output_format=md#comment-content-6466)
 8.    [laurencebahiirwa](https://profiles.wordpress.org/laurencebahiirwa/)  [  3 years ago  ](https://developer.wordpress.org/reference/hooks/allowed_block_types_all/#comment-6466)
 9.  [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fallowed_block_types_all%2F%23comment-6466)
     Vote results for this note: 2[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fallowed_block_types_all%2F%23comment-6466)
 10. To find the list of all the core blocks that can be filtered, see: [https://developer.wordpress.org/block-editor/reference-guides/core-blocks/](https://developer.wordpress.org/block-editor/reference-guides/core-blocks/)
 11.  [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fallowed_block_types_all%2F%3Freplytocom%3D6466%23feedback-editor-6466)
 12.  [Skip to note 6 content](https://developer.wordpress.org/reference/hooks/allowed_block_types_all/?output_format=md#comment-content-5581)
 13.   [thejaydip](https://profiles.wordpress.org/iamjaydip/)  [  4 years ago  ](https://developer.wordpress.org/reference/hooks/allowed_block_types_all/#comment-5581)
 14. [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fallowed_block_types_all%2F%23comment-5581)
     Vote results for this note: 0[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fallowed_block_types_all%2F%23comment-5581)
 15. **Basic Example**
 16.     ```php
         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 );
         ```
     
 17.  [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fallowed_block_types_all%2F%3Freplytocom%3D5581%23feedback-editor-5581)

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fallowed_block_types_all%2F)
before being able to contribute a note or feedback.