diff --git a/backport-changelog/6.9/8063.md b/backport-changelog/6.9/8063.md index 8a4613e59e2bd0..004b8b9a194af2 100644 --- a/backport-changelog/6.9/8063.md +++ b/backport-changelog/6.9/8063.md @@ -2,5 +2,6 @@ https://github.com/WordPress/wordpress-develop/pull/8063 * https://github.com/WordPress/gutenberg/pull/67125 * https://github.com/WordPress/gutenberg/pull/71811 +* https://github.com/WordPress/gutenberg/pull/72003 * https://github.com/WordPress/gutenberg/pull/72029 * https://github.com/WordPress/gutenberg/pull/72049 diff --git a/lib/compat/wordpress-6.9/site-editor-redirect.php b/lib/compat/wordpress-6.9/site-editor-redirect.php new file mode 100644 index 00000000000000..401a5fae06d5ab --- /dev/null +++ b/lib/compat/wordpress-6.9/site-editor-redirect.php @@ -0,0 +1,39 @@ + /wp_registered_template/tt5//home + if ( isset( $_REQUEST['p'] ) && preg_match( '#^/wp_template/([a-zA-Z0-9-]+//[a-zA-Z0-9-]+)$#', $_REQUEST['p'], $matches ) ) { + return add_query_arg( array( 'p' => '/wp_registered_template/' . $matches[1] ), remove_query_arg( array( 'p' ) ) ); + } + + return false; +} + +/** + * Redirect old site editor urls to the new updated ones. + */ +function gutenberg_redirect_site_editor_deprecated_urls_6_9() { + $redirection = gutenberg_get_site_editor_redirection_6_9(); + if ( false !== $redirection ) { + wp_safe_redirect( $redirection ); + exit; + } +} +add_action( 'admin_init', 'gutenberg_redirect_site_editor_deprecated_urls_6_9' ); diff --git a/lib/load.php b/lib/load.php index 83bdd73d730a83..b0376b144cb46f 100644 --- a/lib/load.php +++ b/lib/load.php @@ -90,6 +90,7 @@ function gutenberg_is_experiment_enabled( $name ) { require __DIR__ . '/compat/wordpress-6.9/command-palette.php'; require __DIR__ . '/compat/wordpress-6.9/preload.php'; require __DIR__ . '/compat/wordpress-6.9/l10n.php'; +require __DIR__ . '/compat/wordpress-6.9/site-editor-redirect.php'; // WordPress 7.0 compat. require __DIR__ . '/compat/wordpress-7.0/php-only-blocks.php';