Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move site editor 6.2 specific code to the right file #48023

Merged
merged 1 commit into from
Feb 13, 2023
Merged
Show file tree
Hide file tree
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
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 @@ -101,9 +101,6 @@ function gutenberg_is_experiment_enabled( $name ) {
require __DIR__ . '/compat/wordpress-6.2/html-api/class-wp-html-tag-processor.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