• Hello there,
    I’d like to have in my website two url prefixes to reach two different api base paths, in particular:

    1) I need to keep wp-json url prefix
    2) I need to create a new prefix called api, so I can create new routes and endpoints there.
    I’ve found this method

    add_filter( 'rest_url_prefix', 'rest_url_prefix' );
    
    function rest_url_prefix( ) {
      return 'api';
    }

    but it hides also wp-json, while I’d need to create a new url prefix, different from it but working concurrently. How can I achieve it?
    Thanks

Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How to add a new custom rest url prefix in WordPress?’ is closed to new replies.