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

current rest-api.php breaks sites when saving options-general.php (10.7.1-10.7.3) #32486

Closed
niaccurshi opened this issue Jun 7, 2021 · 2 comments

Comments

@niaccurshi
Copy link

If you create a site using the Gutenberg plugin that is version 10.7.1 through 10.7.3 inclusive, you can't save any settings on the general options page in the CMS without it breaking the site. It removes the values for the stylesheet and theme_mods_ options in the options table.

This resolves the problem: #32229

As does (in a rough and potentially overreaching example) this code in your theme functions:

add_action('init',function() {

	unregister_setting(
		'general',
		'theme_mods_' . get_option( 'stylesheet' )
	);

	unregister_setting(
		'general',
		'stylesheet'
	);

	remove_filter( 'rest_pre_get_setting', 'gutenberg_rest_pre_get_setting_filter_custom_logo', 10 );
	remove_filter( 'rest_pre_update_setting', 'gutenberg_rest_pre_set_setting_filter_theme_mods', 10 );

});

It's frustrating that this is a particularly nasty bug for losing certain options on the site if you fall foul of it, and may not be discovered until well after any backup and install procedure for new plugins.

We could really do with the pull request linked to above being fast-tracked! Here again for clarity: #32229

@cpapazoglou
Copy link
Contributor

Related comment #32229 (comment)

@talldan
Copy link
Contributor

talldan commented Jun 10, 2021

Judging by the comments, looks like this is now fixed as of Gutenberg 10.8, but let me know if I'm wrong.

@talldan talldan closed this as completed Jun 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants