-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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: Custom settings endpoint #1455
Comments
If it's just GET/POST for simple options, why not use the existing REST API endpoint for that? |
@swissspidy I was not aware of such endpoint, I must have missed it? Can't seem to find it in the REST API docs? |
@youknowriad here's the link to the docs: https://developer.wordpress.org/rest-api/reference/settings/. Registered settings can be fetched/saved using that endpoint. |
Oh thanks for the clarification, I thought this endpoint would return only the settings mentioned in the docs. So if I understand correctly, we'd need to register our settings using this right? https://codex.wordpress.org/Function_Reference/register_setting The settings API seems more suited towards generating Admin Pages, is it ok to skip generating admin pages for those? |
Although the Settings API itself is meant for adding fields to admin pages (using See https://make.wordpress.org/core/2016/10/26/registering-your-settings-in-wordpress-4-7/ Think of that function as a way to register a setting for the REST API, nothing else. |
Awesome, thanks, this is really helpful. Will unblock some issues |
We can't use |
And I think the settings we need to store should be per user. We need a user preferences endpoint. |
Yes, good point. We could try a |
We need an endpoint like this for #1859, did we come to a conclusion on this? I'm happy to start on a user preferences endpoint. (Because, I kinda need it to progress 😄 ) |
The conclusion is that we need a user preferences endpoint 😄 Feel free to give it a shot. |
@nylen should we create a new |
Yes, our endpoints should live in See also https://core.trac.wordpress.org/ticket/40919 which we can incorporate to provide a way to call the endpoints we need. |
Removing "Core REST API Task" as this is something we can implement for ourselves for now. |
The label is mostly meant to gather all the issues that need API work, regardless of where it is done. |
I reopened #1948 . There are discussions going on around userSettings which might give us what we need, but if not, that PR is there. |
Do we 100% need to persist this to server? I think using the new |
I guess not 100%, but it would be nice if we were able to store data at a user level rather than a device+browser level. |
It might make sense to rename the label, it's specifically "Core REST API" right now. |
Is this issue actionable at this point, or can it be closed? |
It looks like the first issue was solved with |
We need to persist different settings in different places of the Gutenberg Editor. Does it make sense to create a generic endpoint performing
get/set_option
?We need it for:
cc @nylen
The text was updated successfully, but these errors were encountered: