On this page
WP_REST_Sidebars_Controller::get_items_permissions_check( WP_REST_Request $request ): true|WP_Error
Checks if a given request has access to get sidebars.
Parameters
$requestWP_REST_Request Required-
Full details about the request.
Return
true|WP_Error True if the request has read access, WP_Error object otherwise.
Source
File: wp-includes/rest-api/endpoints/class-wp-rest-sidebars-controller.php. View all references
public function get_items_permissions_check( $request ) {
$this->retrieve_widgets();
foreach ( wp_get_sidebars_widgets() as $id => $widgets ) {
$sidebar = $this->get_sidebar( $id );
if ( ! $sidebar ) {
continue;
}
if ( $this->check_read_permission( $sidebar ) ) {
return true;
}
}
return $this->do_permissions_check();
}
Related
Uses
| Uses | Description |
|---|---|
| WP_REST_Sidebars_Controller::retrieve_widgets() wp-includes/rest-api/endpoints/class-wp-rest-sidebars-controller.php | Looks for “lost” widgets once per request. |
| WP_REST_Sidebars_Controller::check_read_permission() wp-includes/rest-api/endpoints/class-wp-rest-sidebars-controller.php | Checks if a sidebar can be read publicly. |
| WP_REST_Sidebars_Controller::get_sidebar() wp-includes/rest-api/endpoints/class-wp-rest-sidebars-controller.php | Retrieves the registered sidebar with the given id. |
| WP_REST_Sidebars_Controller::do_permissions_check() wp-includes/rest-api/endpoints/class-wp-rest-sidebars-controller.php | Checks if the user has permissions to make the request. |
| wp_get_sidebars_widgets() wp-includes/widgets.php | Retrieve full list of sidebars and their widget instance IDs. |
Changelog
| Version | Description |
|---|---|
| 5.8.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_rest_sidebars_controller/get_items_permissions_check