diff --git a/php/blocks/class-loader.php b/php/blocks/class-loader.php index 9a70208dd..95918fbc1 100644 --- a/php/blocks/class-loader.php +++ b/php/blocks/class-loader.php @@ -63,8 +63,21 @@ public function register_hooks() { * PHP block loading. */ add_action( 'plugins_loaded', array( $this, 'dynamic_block_loader' ) ); - } + /** + * Workaround for users with different settings for Site Address and WordPress Address. + * + * @see https://github.com/WordPress/gutenberg/issues/1761 + */ + if ( is_admin() && home_url() !== site_url() ) { + add_filter( + 'rest_url', + function( $url ) { + return str_replace( home_url(), site_url(), $url ); + } + ); + } + } /** * Launch the blocks inside Gutenberg.