diff --git a/backport-changelog/6.8/7903.md b/backport-changelog/6.8/7903.md index cb20d8d2dd2b1..60703831a8e39 100644 --- a/backport-changelog/6.8/7903.md +++ b/backport-changelog/6.8/7903.md @@ -1,3 +1,5 @@ https://github.com/WordPress/wordpress-develop/pull/7903 * https://github.com/WordPress/gutenberg/pull/67199 +* https://github.com/WordPress/gutenberg/pull/68971 + diff --git a/lib/compat/wordpress-6.8/site-editor.php b/lib/compat/wordpress-6.8/site-editor.php index 9b2575676047d..82ac118b013c1 100644 --- a/lib/compat/wordpress-6.8/site-editor.php +++ b/lib/compat/wordpress-6.8/site-editor.php @@ -15,6 +15,16 @@ function ( $settings ) { } ); +/** + * Maps old site editor urls to the new updated ones. + * + * @since 6.8.0 + * @access private + * + * @global string $pagenow The filename of the current screen. + * + * @return string|false The new URL to redirect to, or false if no redirection is needed. + */ function gutenberg_get_site_editor_redirection() { global $pagenow; if ( 'site-editor.php' !== $pagenow || isset( $_REQUEST['p'] ) || ! $_SERVER['QUERY_STRING'] ) { @@ -96,10 +106,13 @@ function gutenberg_get_site_editor_redirection() { return add_query_arg( array( 'p' => '/' ) ); } +/** + * Redirect old site editor urls to the new updated ones. + */ function gutenberg_redirect_site_editor_deprecated_urls() { $redirection = gutenberg_get_site_editor_redirection(); if ( false !== $redirection ) { - wp_redirect( $redirection, 301 ); + wp_safe_redirect( $redirection ); exit; } }