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

A PHP warning is thrown whenever a plugin calls register_setting without the show_in_rest argument #60859

Closed
leonidasmi opened this issue Apr 18, 2024 · 0 comments · Fixed by #60862
Assignees
Labels
REST API Interaction Related to REST API [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended

Comments

@leonidasmi
Copy link

Description

With Gutenberg 18.0+, if a theme/plugin uses the register_setting() core function without using the show_in_rest, then the

Warning:  Undefined array key "show_in_rest" in /wp-content/plugins/gutenberg/lib/compat/wordpress-6.6/option.php on line 35`

is thrown.

I believe Gutenberg should add defensive coding around this line, because according to the show_in_rest argument is not required and I expect to see a lot of those warnings in the wild.

For example, Yoast SEO's settings pages use the register_setting() function without the show_in_rest arg, so that warning is consistently thrown there.

Step-by-step reproduction instructions

  1. Install Gutenberg latest version and & Yoast SEO
  2. Go to Yoast SEO->Settings
  3. Confirm that you get a Warning: Undefined array key "show_in_rest" warning

Screenshots, screen recording, code snippet

No response

Environment info

No response

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

No

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
REST API Interaction Related to REST API [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants