apply_filters( 'rest_menu_read_access', bool $read_only_access, WP_REST_Request $request, WP_REST_Controller $controller )
- Since
- 6.8.0
Filters whether the current user has read access to menu items via the REST API.
Compatibility
- WordPress
- since 6.8.0
- 6.7.7
- 6.8.8
- 6.9.7
- 7.0.4
- 7.1.0
Present in 4 of the 5 tracked releases, added in 6.8.0.
Parameters
$read_only_accessbool- Whether the current user has read access to menu items via the REST API.
$requestWP_REST_Request- Full details about the request.
$controllerWP_REST_Controller- The current instance of the controller.
Where this hook fires · 3
wp-includes/rest-api/endpoints/class-wp-rest-menu-items-controller.php:93WP_REST_Menu_Items_Controller::check_has_read_only_access()wp-includes/rest-api/endpoints/class-wp-rest-menu-locations-controller.php:154WP_REST_Menu_Locations_Controller::check_has_read_only_access()wp-includes/rest-api/endpoints/class-wp-rest-menus-controller.php:88WP_REST_Menus_Controller::check_has_read_only_access()
Source code
* * @param bool $read_only_access Whether the current user has read access to menu items * via the REST API. * @param WP_REST_Request $request Full details about the request. * @param WP_REST_Controller $controller The current instance of the controller. */ $read_only_access = apply_filters( 'rest_menu_read_access', false, $request, $this ); if ( $read_only_access ) { return true; } if ( current_user_can( 'edit_theme_options' ) ) { return true;Changelog
Introduced in 6.8.0. 2 changes between 6.8.8 and 7.1.0.
Signature, return type and hooks compared across 4 parsed releases.
6.9.7
Parameter
$controller added.verified against source6.9.7
Parameter
$this removed.verified against source6.8.0
Introduced.from the docblock
About this page
- Parsed data
- Generated from the wordpress-develop 7.1.0 tag, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
- Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.