WP_REST_Blocks_Controller::check_read_permission()publicWP 5.0.0

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() code WP 6.5.2

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 );
}