apply_filters( 'rest_block_hooks_post_types', string[] $content_like_post_types, string $post_type, stdClass|WP_Post $prepared_post )
- Since
- 7.0.0
Filters which post types should have Block Hooks applied.
Description
Allows themes and plugins to add or remove post types that should have Block Hooks functionality enabled in the REST API.
Compatibility
- WordPress
- since 7.0.0
- 6.7.7
- 6.8.8
- 6.9.7
- 7.0.4
- 7.1.0
Present in 2 of the 5 tracked releases, added in 7.0.0.
Parameters
$content_like_post_typesstring[]- Array of post type names that support Block Hooks.
$post_typestring- The current post type being processed.
$prepared_poststdClass|WP_Post- The prepared post object.
Where this hook fires · 2
wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php:1508WP_REST_Posts_Controller::prepare_item_for_database()wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php:2176WP_REST_Posts_Controller::prepare_item_for_response()
Source code
* @since 7.0.0 * * @param string[] $content_like_post_types Array of post type names that support Block Hooks. * @param string $post_type The current post type being processed. * @param stdClass|WP_Post $prepared_post The prepared post object. */ $content_like_post_types = apply_filters( 'rest_block_hooks_post_types', $content_like_post_types, $this->post_type, $prepared_post ); if ( in_array( $this->post_type, $content_like_post_types, true ) ) { $prepared_post = update_ignored_hooked_blocks_postmeta( $prepared_post ); } /**Changelog
Introduced in 7.0.0. 2 changes between 7.0.4 and 7.1.0.
Signature, return type and hooks compared across 2 parsed releases.
7.1.0
Parameter
$content_like_post_types retyped from array to string[].verified against source7.1.0
Parameter
$prepared_post retyped from object to stdClass|WP_Post.verified against source7.0.0
Introduced.from the docblock
About this page
- Parsed data
- Generated from the wordpress-develop 7.1.0 tag, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
- Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.