Rest API plugin wordpress disable default routes

Hello guy’s Please help me i install REST API plugin WP and i adding some specific route and any things it’s work fine as i wont. But I want to disable default route exemple :
/wp-json/
/wp-json/wp/v2/posts

Related posts

Leave a Reply

2 comments

  1. As of WordPress 4.7 it seems to be the following (noting 99 instead of 0):

    remove_action('rest_api_init', 'create_initial_rest_routes', 99);
    

    However this will also remove any custom content type routes. So instead you may choose to use:

    add_filter('rest_endpoints', function($endpoints) {
    
        unset( $endpoints['/wp/v2/users'] );
        // etc
    
        return $endpoints;
    });