Title: rest_prepare_menu_location
Published: February 3, 2022
Last modified: May 20, 2026

---

# apply_filters( ‘rest_prepare_menu_location’, WP_REST_Response $response, object $location, WP_REST_Request $request )

## In this article

 * [Parameters](https://developer.wordpress.org/reference/hooks/rest_prepare_menu_location/?output_format=md#parameters)
 * [Source](https://developer.wordpress.org/reference/hooks/rest_prepare_menu_location/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/hooks/rest_prepare_menu_location/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/hooks/rest_prepare_menu_location/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/hooks/rest_prepare_menu_location/?output_format=md#wp--skip-link--target)

Filters menu location data returned from the REST API.

## 󠀁[Parameters](https://developer.wordpress.org/reference/hooks/rest_prepare_menu_location/?output_format=md#parameters)󠁿

 `$response`[WP_REST_Response](https://developer.wordpress.org/reference/classes/wp_rest_response/)

The response object.

`$location`object

The original location object.

`$request`[WP_REST_Request](https://developer.wordpress.org/reference/classes/wp_rest_request/)

Request used to generate the response.

## 󠀁[Source](https://developer.wordpress.org/reference/hooks/rest_prepare_menu_location/?output_format=md#source)󠁿

    ```php
    return apply_filters( 'rest_prepare_menu_location', $response, $location, $request );
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/rest-api/endpoints/class-wp-rest-menu-locations-controller.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.0/src/wp-includes/rest-api/endpoints/class-wp-rest-menu-locations-controller.php#L220)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-includes/rest-api/endpoints/class-wp-rest-menu-locations-controller.php#L220-L220)

## 󠀁[Related](https://developer.wordpress.org/reference/hooks/rest_prepare_menu_location/?output_format=md#related)󠁿

| Used by | Description | 
| [WP_REST_Menu_Locations_Controller::prepare_item_for_response()](https://developer.wordpress.org/reference/classes/wp_rest_menu_locations_controller/prepare_item_for_response/)`wp-includes/rest-api/endpoints/class-wp-rest-menu-locations-controller.php` |

Prepares a menu location object for serialization.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/hooks/rest_prepare_menu_location/?output_format=md#changelog)󠁿

| Version | Description | 
| [5.9.0](https://developer.wordpress.org/reference/since/5.9.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Frest_prepare_menu_location%2F)
before being able to contribute a note or feedback.