Forum Replies Created

Viewing 1 replies (of 1 total)
  • @nr2012 I am facing the same problem. I use WP as a headless CMS for our company blog. Would you be able to describe the steps involved for adding the filter?

    add_filter('rest_url', function($url) {
    	// removing /wp at the end of site_url
    	$pattern = '/(\S+)(\/wp\/?)$/';
    	$siteURL = preg_replace($pattern, '${1}', site_url());
    	$url = str_replace(home_url(), $siteURL, $url);
    	return $url;
    });
    
Viewing 1 replies (of 1 total)