• How do I hide the url field that is populated from WordPress Address (URL) in REST API endpoint?

    I am building a headless site, so it is necessary for me to hide the backend url from the public accessible REST API.

    • This topic was modified 2 years, 5 months ago by Hayden Ng.
Viewing 1 replies (of 1 total)
  • Try this:

    add_filter( 'rest_pre_echo_response', function( $response ) {
        unset($response["url"]);
        unset($response["home"]);
        return $response;
    }, 10, 1 );
Viewing 1 replies (of 1 total)
  • The topic ‘Hide WordPress URL in REST API endpoint’ is closed to new replies.