Skip to content

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

@leonidasmi

Description

@leonidasmi

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

Metadata

Metadata

Assignees

Labels

REST API InteractionRelated to REST API[Status] In ProgressTracking issues with work in progress[Type] BugAn existing feature does not function as intended

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions