REST API: Add gmt_offset to base /wp-json response
|Reported by:||jnylen0||Owned by:||jnylen0|
|Component:||REST API||Keywords:||has-patch has-unit-tests fixed-major|
API clients often have a need to retrieve information about the current site. This doesn't fit into the wp/v2/settings endpoint for a couple of reasons:
- That endpoint requires administrative privileges (current_user_can( 'manage_options' )). See also #38731.
- We decided not to implement finer-grained permissions on the settings endpoint, as a read-only piece of information isn't a read/write "setting". See also ticket:38490#comment:10.
The most immediately obvious piece of information to add is gmt_offset. This is a crucial piece of information for any clients that need to manipulate datetimes returned via the API, but it's not currently available anywhere. See also ticket:38342#comment:48 for the specific case of Quick Draft inside wp-admin.
I expect we will need to enhance the base /wp-json response to accept a ?context=edit or similar parameter - so let's use this ticket for both the approach to /wp-json and the addition of the gmt_offset field specifically.
Change History (30)
- Keywords has-patch needs-unit-tests needs-refresh dev-feedback added
- Owner set to jnylen0
- Status changed from new to accepted
- Keywords has-patch added; needs-refresh dev-feedback needs-patch removed
- Keywords has-unit-tests added; needs-unit-tests removed
- Milestone changed from 4.8 to 4.7.4
- Keywords fixed-major added; commit removed
- Resolution fixed deleted
- Status changed from closed to reopened