rest_menu_read_access
Filter HookDescription
Checks whether the current user has read permission for the endpoint.Hook Information
File Location |
wp-includes/rest-api/endpoints/class-wp-rest-menu-locations-controller.php
View on GitHub
|
Hook Type | Filter |
Line Number | 154 |
Hook Parameters
Type | Name | Description |
---|---|---|
WP_REST_Request
|
$request
|
Full details about the request. |
Usage Examples
Basic Usage
<?php
// Hook into rest_menu_read_access
add_filter('rest_menu_read_access', 'my_custom_filter', 10, 1);
function my_custom_filter($request) {
// Your custom filtering logic here
return $request;
}
Source Code Context
wp-includes/rest-api/endpoints/class-wp-rest-menu-locations-controller.php:154
- How this hook is used in WordPress core
<?php
149 * @param WP_REST_Request $request Full details about the request.
150 * @return true|WP_Error True if the current user has permission, WP_Error object otherwise.
151 */
152 protected function check_has_read_only_access( $request ) {
153 /** This filter is documented in wp-includes/rest-api/endpoints/class-wp-rest-menu-items-controller.php */
154 $read_only_access = apply_filters( 'rest_menu_read_access', false, $request, $this );
155 if ( $read_only_access ) {
156 return true;
157 }
158
159 if ( ! current_user_can( 'edit_theme_options' ) ) {
PHP Documentation
<?php
/**
* Checks whether the current user has read permission for the endpoint.
*
* @since 6.8.0
*
* @param WP_REST_Request $request Full details about the request.
* @return true|WP_Error True if the current user has permission, WP_Error object otherwise.
*/
Quick Info
- Hook Type: Filter
- Parameters: 1
- File: wp-includes/rest-api/endpoints/class-wp-rest-menu-locations-controller.php
Related Hooks
Related hooks will be displayed here in future updates.