rest_menu_read_access filter-hookWP 6.8.0

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 $that             The current instance of the controller.
 *
 * @return bool
 */
function wp_kama_rest_menu_read_access_filter( $read_only_access, $request, $that ){

	// 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.
$that(WP_REST_Controller)
The current instance of the controller.

Changelog

Since 6.8.0 Introduced.

Where the hook is called

WP_REST_Menu_Items_Controller::check_has_read_only_access()
rest_menu_read_access
WP_REST_Menus_Controller::check_has_read_only_access()
rest_menu_read_access
WP_REST_Menu_Locations_Controller::check_has_read_only_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 );

Where the hook is used in WordPress

Usage not found.