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

REST API: Add missing options to the settings endpoint #2893

Closed

Conversation

Mamaduka
Copy link
Member

PR registers options for the settings endpoints. Unfortunately, we missed them during WP 6.0 backports - WordPress/gutenberg#38607 (comment).

Testing Instructions

  1. Open a Post or Page editor.
  2. Run this snippet in the DevTools console - wp.data.select('core').getEntityRecord( 'root', 'site' );
  3. Confirm newly registered settings are returned.

Trac ticket: https://core.trac.wordpress.org/ticket/56058


This Pull Request is for code review only. Please keep all other discussions in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.

@Mamaduka
Copy link
Member Author

I'm not sure how to fix the remaining failure. Is there a command for regenerating API fixtures?

@spacedmonkey
Copy link
Member

@Mamaduka If you run the tests locally, but running npm run test:php, it should regenerate that file. Just it and push it and it will fix the tests.

Copy link
Member

@spacedmonkey spacedmonkey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

@SergeyBiryukov
Copy link
Member

Thanks for the PR!

This was merged to WP trunk in https://core.trac.wordpress.org/changeset/53588, but I noticed that the new options are the only ones in register_initial_settings() that use the number type instead of integer. If I'm reading it correctly, that means they can technically be floats. Since both page_on_front and page_for_posts are page IDs, should they be integer?

@Mamaduka
Copy link
Member Author

Thanks for catching that, @SergeyBiryukov 🙇

@SergeyBiryukov
Copy link
Member

I've made a follow-up commit that switches the type to integer as per the comment above :)

@SergeyBiryukov
Copy link
Member

SergeyBiryukov commented Jun 29, 2022

Thanks for the confirmation that it was OK to change the type :) Merged in https://core.trac.wordpress.org/changeset/53589.

Backported to the 6.0 branch in https://core.trac.wordpress.org/changeset/53590.

@Mamaduka Mamaduka deleted the add/missing-rest-api-settings branch September 13, 2022 07:47
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

Successfully merging this pull request may close these issues.

3 participants