WP_REST_Blocks_Controller::check_read_permission()
Checks if a pattern can be read.
Method of the class: WP_REST_Blocks_Controller{}
No Hooks.
Return
true|false
. Whether the pattern 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. |
WP_REST_Blocks_Controller::check_read_permission() WP REST Blocks Controller::check read permission code WP 6.8
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 ); }