Filter hook 'rest_prepare_menu_location'

in WP Core File wp-includes/rest-api/endpoints/class-wp-rest-menu-locations-controller.php at line 220

View Source

rest_prepare_menu_location

Filter Hook
Description
Filters menu location data returned from the REST API.

Hook Information

File Location wp-includes/rest-api/endpoints/class-wp-rest-menu-locations-controller.php View on GitHub
Hook Type Filter
Line Number 220

Hook Parameters

Type Name Description
WP_REST_Response $response The response object.
object $location The original location object.
WP_REST_Request $request Request used to generate the response.

Usage Examples

Basic Usage
<?php
// Hook into rest_prepare_menu_location
add_filter('rest_prepare_menu_location', 'my_custom_filter', 10, 3);

function my_custom_filter($response, $location, $request) {
    // Your custom filtering logic here
    return $response;
}

Source Code Context

wp-includes/rest-api/endpoints/class-wp-rest-menu-locations-controller.php:220 - How this hook is used in WordPress core
<?php
 215  		 *
 216  		 * @param WP_REST_Response $response The response object.
 217  		 * @param object           $location The original location object.
 218  		 * @param WP_REST_Request  $request  Request used to generate the response.
 219  		 */
 220  		return apply_filters( 'rest_prepare_menu_location', $response, $location, $request );
 221  	}
 222  
 223  	/**
 224  	 * Prepares links for the request.
 225  	 *

PHP Documentation

<?php
/**
		 * Filters menu location data returned from the REST API.
		 *
		 * @since 5.9.0
		 *
		 * @param WP_REST_Response $response The response object.
		 * @param object           $location The original location object.
		 * @param WP_REST_Request  $request  Request used to generate the response.
		 */
Quick Info
  • Hook Type: Filter
  • Parameters: 3
  • File: wp-includes/rest-api/endpoints/class-wp-rest-menu-locations-controller.php
Related Hooks

Related hooks will be displayed here in future updates.