Skip to content

Commit

Permalink
Move 6.2 specific code to the right place (#48023)
Browse files Browse the repository at this point in the history
  • Loading branch information
youknowriad authored and ntsekouras committed Feb 14, 2023
1 parent 5a7f4a2 commit 1e749f0
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 30 deletions.
21 changes: 21 additions & 0 deletions lib/compat/wordpress-6.2/site-editor.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,24 @@ function gutenberg_site_editor_unset_homepage_setting( $settings, $context ) {
return $settings;
}
add_filter( 'block_editor_settings_all', 'gutenberg_site_editor_unset_homepage_setting', 10, 2 );

/**
* Overrides the site editor initialization for WordPress 6.2 and cancels the redirection.
* The logic of this function is not important, we just need to remove the redirection from core.
*
* @param string $location Location.
*
* @return string Updated location.
*/
function gutenberg_prevent_site_editor_redirection( $location ) {
if ( strpos( $location, 'site-editor.php' ) !== false && strpos( $location, '?' ) !== false ) {
return add_query_arg(
array( 'postId' => 'none' ),
admin_url( 'site-editor.php' )
);
}

return $location;
}

add_filter( 'wp_redirect', 'gutenberg_prevent_site_editor_redirection', 1 );
27 changes: 0 additions & 27 deletions lib/compat/wordpress-6.3/site-editor.php

This file was deleted.

3 changes: 0 additions & 3 deletions lib/load.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,6 @@ function gutenberg_is_experiment_enabled( $name ) {
require __DIR__ . '/compat/wordpress-6.2/theme.php';
require __DIR__ . '/compat/wordpress-6.2/widgets.php';

// WordPress 6.3 compat.
require __DIR__ . '/compat/wordpress-6.3/site-editor.php';

// Experimental features.
remove_action( 'plugins_loaded', '_wp_theme_json_webfonts_handler' ); // Turns off WP 6.0's stopgap handler for Webfonts API.
require __DIR__ . '/experimental/block-editor-settings-mobile.php';
Expand Down

0 comments on commit 1e749f0

Please sign in to comment.