On this page
WP_REST_Blocks_Controller::check_read_permission( WP_Post $post ): bool
Checks if a block can be read.
Parameters
$postWP_Post Required-
Post object that backs the block.
Return
bool Whether the block can be read.
Source
File: wp-includes/rest-api/endpoints/class-wp-rest-blocks-controller.php. View all references
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 );
}
Related
Uses
| Uses | Description |
|---|---|
| WP_REST_Posts_Controller::check_read_permission() wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php | Checks if a post can be read. |
| current_user_can() wp-includes/capabilities.php | Returns whether the current user has the specified capability. |
Changelog
| Version | Description |
|---|---|
| 5.0.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_rest_blocks_controller/check_read_permission