You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Sep 24, 2018. It is now read-only.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I've been chatting about this with @rmccue and we are considering making the response object key => { value: "A value", group: "A group", ... } to allow for more things to be specific about a setting.
This would be a lot better for forward compatibility as any other fields for a specific setting could be added to the object.
Does this mean that you could then store null values? Like sending {"blogname": null} can mean delete vs storing an actual null could be {"blogname": {"value": null}}. Normal updates would then look like {"blogname": {"value": "Example"}}.
@westonruter no, you can't store a value as null - doing so essentially causes a delete_option on that option value, in which case the option is basically set back to it's default value.
This is only for the response format, not the storage, so this would not effect being (or rather not being) able to store null in an option.
Discussed in slack during Oct 3 team meeting, decisions to be documented here by @joehoyle—tl;dr is that we are going to stick with key: 'value' (as opposed to key: { value: 'value' }) for now, and will attempt to expose group information via the schema.
Additional slack discussion: I feel that having this resource be publicly queryable, exposing obviously-public content like title, URL & description, and possibly posts_per_page, would be useful. I am 👎 on continuing to load up the root API index with arbitrary options when we have this new /settings resource available (esp. if any of these vary by site in multi-site: not sure how that works)
So we have a couple of things to sort out before merging this, but we are very close:
What do we do if a setting value in the database does not match the type used in register_setting, this becomes a problem when there is serialized data in the option value. Right now we are forcing this to be a null value in the rest api responses. The problem with this approach is sending that data back to the settings endpoint will cause a delete of that option value (as null in this case is essentially a delete operation).
Having support for object recursion and array types in the Schema would be very nice, allowing settings that are either objects or arrays. Though this doesn't need to be done for merge I think.
Currently reading all options is behind a manage_options cap check, we need to work out if we want to publicly expose option values for some settings. If we do this, we'd need a way in register_setting or via some kind of read_setting meta cap to work out what settings should be exposed publicly (or at specific permissions checks).
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
None yet
5 participants
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Merged in from https://github.com/WP-API/wp-api-site-endpoints. The
bulk of this comes from
WP-API/wp-api-site-endpoints#13