Using register_setting() and the REST API

Here is a comment I just requested be added to the bottom of the register_setting() page.

If you plan to use your setting in the REST API, use both the rest_api_init and admin_init hooks when calling register_setting() instead of just admin_init. The show_in_rest argument is ineffective when hooked into admin_init alone.

Corey Salzano

Someday, when my comment is approved, you’ll be able to see it on this page and save an hour or two of debugging time. If you can see my comment on this page, please let me know.

Leave a comment

Your email address will not be published. Required fields are marked *