WP_REST_Blocks_Controller::check_read_permission( object $post )
Checks if a block can be read.
Description
Parameters
- $post
-
(object) (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
public function check_read_permission( $post ) { // Ensure that the user is logged in and has the read_blocks capability. $post_type = get_post_type_object( $post->post_type ); if ( ! current_user_can( $post_type->cap->read_post, $post->ID ) ) { return false; } return parent::check_read_permission( $post ); }
Changelog
Version | Description |
---|---|
5.0.0 | Introduced. |