WP_REST_Blocks_Controller::check_read_permission() public WP 5.0.0
Checks if a block can be read.
{} It's a method of the class: WP_REST_Blocks_Controller{}
No Hooks.
Return
true/false. Whether the block can be read.
Usage
$WP_REST_Blocks_Controller = new WP_REST_Blocks_Controller(); $WP_REST_Blocks_Controller->check_read_permission( $post );
- $post(WP_Post) (required)
- Post object that backs the block.
Changelog
Since 5.0.0 | Introduced. |
Code of WP_REST_Blocks_Controller::check_read_permission() WP REST Blocks Controller::check read permission WP 5.6
public function check_read_permission( $post ) {
// By default the read_post capability is mapped to edit_posts.
if ( ! current_user_can( 'read_post', $post->ID ) ) {
return false;
}
return parent::check_read_permission( $post );
}