How to make Gutenberg block editor work, when WordPress Address & Site Address are different domains
Here is the snippet code is given below, which uses ‘rest_url‘ filter to replace the HOME URL in REST API URL to SITE URL.
// change WordPress API URL to HOME URL
add_filter('rest_url', 'wptips_home_url_as_api_url');
function wptips_home_url_as_api_url($url) {
$url = str_replace(home_url(),site_url() , $url);
return $url;
}