WordPress at Your Fingertips
function is not described

WP_REST_Widget_Types_Controller::check_read_permission() protected WP 5.8.0

Checks whether the user can read widget types.

{} It's a method of the class: WP_REST_Widget_Types_Controller{}

No Hooks.


true|WP_Error. True if the widget type is visible, WP_Error otherwise.


// protected - for code of main (parent) or child class
$result = $this->check_read_permission();


Since 5.8.0 Introduced.

Code of WP_REST_Widget_Types_Controller::check_read_permission() WP 5.8.1

protected function check_read_permission() {
	if ( ! current_user_can( 'edit_theme_options' ) ) {
		return new WP_Error(
			__( 'Sorry, you are not allowed to manage widgets on this site.' ),
				'status' => rest_authorization_required_code(),

	return true;