WP_REST_Blocks_Controller::check_read_permission() WordPress Method

The WP_REST_Blocks_Controller::check_read_permission() method is used to check if the current user has permission to read block types.

WP_REST_Blocks_Controller::check_read_permission( WP_Post $post ) #

Checks if a block can be read.


Parameters

$post

(WP_Post)(Required)Post object that backs the block.


Top ↑

Return

(bool) Whether the block can be read.


Top ↑

Source

File: wp-includes/rest-api/endpoints/class-wp-rest-blocks-controller.php

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


Top ↑

Changelog

Changelog
VersionDescription
5.0.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.