rest_block_hooks_post_types
Filters which post types should have Block Hooks applied.
Allows themes and plugins to add or remove post types that should have Block Hooks functionality enabled in the REST API.
Использование
add_filter( 'rest_block_hooks_post_types', 'wp_kama_rest_block_hooks_post_types_filter', 10, 3 );
/**
* Function for `rest_block_hooks_post_types` filter-hook.
*
* @param array $content_like_post_types Array of post type names that support Block Hooks.
* @param string $post_type The current post type being processed.
* @param object $prepared_post The prepared post object.
*
* @return array
*/
function wp_kama_rest_block_hooks_post_types_filter( $content_like_post_types, $post_type, $prepared_post ){
// filter...
return $content_like_post_types;
}
- $content_like_post_types(массив)
- Array of post type names that support Block Hooks.
- $post_type(строка)
- The current post type being processed.
- $prepared_post(объект)
- The prepared post object.
Список изменений
| С версии 7.0.0 | Введена. |
Где вызывается хук
rest_block_hooks_post_types
rest_block_hooks_post_types
wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php 1508
$content_like_post_types = apply_filters( 'rest_block_hooks_post_types', $content_like_post_types, $this->post_type, $prepared_post );
wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php 2187
$content_like_post_types = apply_filters( 'rest_block_hooks_post_types', $content_like_post_types, $this->post_type, $post );