WP_REST_Widgets_Controller::check_read_sidebar_permission()protectedWP 5.9.0

Checks if a sidebar can be read publicly.

{} It's a 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.

Code of WP_REST_Widgets_Controller::check_read_sidebar_permission() WP 6.0

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

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