Opened 8 months ago
Last modified 8 months ago
#63493 new defect (bug)
Timezone string doesn't return in REST API /wp-json/wp/v2/settings
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Awaiting Review | Priority: | normal |
| Severity: | normal | Version: | |
| Component: | REST API | Keywords: | has-patch needs-test-info needs-unit-tests close |
| Focuses: | rest-api | Cc: |
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.
8 months ago
#1
- Keywords has-patch added
#3
@
8 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
@
8 months ago
- Keywords needs-unit-tests added
@opurockey Thanks for the feedback! I’ve revised the code based on your suggestion.
#5
@
8 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.
Trac ticket: https://core.trac.wordpress.org/ticket/63493