rest_menu_read_access
Filters whether the current user has read access to menu items via the REST API.
Usage
add_filter( 'rest_menu_read_access', 'wp_kama_rest_menu_read_access_filter', 10, 3 );
/**
* Function for `rest_menu_read_access` filter-hook.
*
* @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.
*
* @return bool
*/
function wp_kama_rest_menu_read_access_filter( $read_only_access, $request, $controller ){
// filter...
return $read_only_access;
}
- $read_only_access(true|false)
- Whether the current user has read access to menu items via the REST API.
- $request(WP_REST_Request)
- Full details about the request.
- $controller(WP_REST_Controller)
- The current instance of the controller.
Changelog
| Since 6.8.0 | Introduced. |
Where the hook is called
rest_menu_read_access
rest_menu_read_access
rest_menu_read_access
wp-includes/rest-api/endpoints/class-wp-rest-menu-items-controller.php 93
$read_only_access = apply_filters( 'rest_menu_read_access', false, $request, $this );
wp-includes/rest-api/endpoints/class-wp-rest-menus-controller.php 88
$read_only_access = apply_filters( 'rest_menu_read_access', false, $request, $this );
wp-includes/rest-api/endpoints/class-wp-rest-menu-locations-controller.php 154
$read_only_access = apply_filters( 'rest_menu_read_access', false, $request, $this );