6

Upon my research the latest question I was able to reference referred to the WP REST API plugin before it was built into core. The best answer on the question referred to building a custom endpoint (I'm not a fan of using the plugin):

function get_menu() {
    # Change 'menu' to your own navigation slug.
    return wp_get_nav_menu_items('menu');
}

add_action( 'rest_api_init', function () {
        register_rest_route( 'myroutes', '/menu', array(
        'methods' => 'GET',
        'callback' => 'get_menu',
    ) );
} );

I was unable to see anything mentioned in the handbook. When reviewing all the routes in Postman I see everything but menus:

enter image description here

Is there a way in WP REST API that is built into core to get the menu without building a custom endpoint? Am I missing it somewhere?

6

Does WP REST API have a built in route for calling menu?

Nope, the menu route is not currently (4.9.7) built-in, but there's a ticket for it in #40878.

It's not mentioned on this REST API roadmap though.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.