WP_REST_Widgets_Controller::check_read_sidebar_permission()protectedWP 5.9.0

Checks if a sidebar can be read publicly.

Method of the class: WP_REST_Widgets_Controller{}

No Hooks.

Return

true|false. Whether the sidebar can be read.

Usage

// protected - for code of main (parent) or child class
$result = $this->check_read_sidebar_permission( $sidebar_id );
$sidebar_id(string) (required)
The sidebar ID.

Changelog

Since 5.9.0 Introduced.

WP_REST_Widgets_Controller::check_read_sidebar_permission() code WP 6.5.2

protected function check_read_sidebar_permission( $sidebar_id ) {
	$sidebar = wp_get_sidebar( $sidebar_id );

	return ! empty( $sidebar['show_in_rest'] );
}