WordPress filter hook
rest_menus_format_menus
Fired by 3 WordPress plugins, running on 2,000+ sites between them.
How to use rest_menus_format_menus
It's a filter: your callback receives the value, and must return the (changed) value.
Add this to your theme's functions.php or a small custom plugin:
add_filter( 'rest_menus_format_menus', function( $rest_menus ) {
// Change $rest_menus here.
return $rest_menus;
}, 10, 1 );Argument names come from WP API Menus's source. Other plugins may pass different values: check the call in the plugin you're targeting below.
3 plugins that fire rest_menus_format_menus
Sorted by active installs. Each entry shows where the plugin calls the hook and what it passes.
-
WP API Menus2,000+ installs
apply_filters( 'rest_menus_format_menus', $rest_menus )includes/wp-api-menus-v2.php:124 -
ng-wp-restFewer than 10 installs
apply_filters( 'rest_menus_format_menus', $rest_menus )includes/ng-wp-rest-menus-controller.php:139 -
WP-RestifyFewer than 10 installs
apply_filters( 'rest_menus_format_menus', $rest_menus )include/class-wp-json-menu2.php:111
Need a customisation built on this hook?
Tell us what you want to change and which plugin it's for. We'll write it, test it and send it back as a small plugin.