Opened 16 months ago
Last modified 16 months ago
#63493 new defect (bug)
Timezone string doesn't return in REST API /wp-json/wp/v2/settings
| Reported by: | phakphumvis | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | Awaiting Review |
| Component: | REST API | Version: | |
| Severity: | normal | Keywords: | has-patch needs-test-info needs-unit-tests close |
| Cc: | Focuses: | rest-api |
Description
Timezone string in REST API /wp-json/wp/v2/settings always return as an empty string even set any timezone from Admin panel -> Settings.
Change History (7)
This ticket was mentioned in PR #8845 on WordPress/wordpress-develop by @nikunj8866.
16 months ago
#1
- Keywords has-patch added
#3
@
16 months ago
timezone string return empty value if you set manual offsets value ( e.g.: UTC -12 ) from Settings->General->Timezone. Better use wp_timezone_string() if timezone value is found empty when using the /wp-json/wp/v2/settings endpoint.
#4
@
16 months ago
- Keywords needs-unit-tests added
@opurockey Thanks for the feedback! I’ve revised the code based on your suggestion.
#5
@
16 months ago
This behaviour is intentional; if the timezone is set via gmt_offset, we want to clearly convey this to clients, rather than a potentially inaccurate timezone.
For example, if the site is set to UTC+1, that would currently (with DST) map to Europe/London, but during winter would map to Europe/Paris. We cannot disambiguate between these, so providing that information clearly to clients is intentional.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Trac ticket: https://core.trac.wordpress.org/ticket/63493