Skip to content
This repository has been archived by the owner on Nov 6, 2022. It is now read-only.

Workaround for users with different Site Address and WordPress URL settings #285

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion php/blocks/class-loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down