Thank you Tom J Nowell for the insightful comment above.
Turns out that wp_timezone is a relatively recent addition to WordPress, and didn’t exist in the version of WP I was developing in. It was added, as the Changelog says, in v5.3
. I was using v5.2
.
The function itself:
function wp_timezone() {
return new DateTimeZone( wp_timezone_string() );
}
Simpy wraps the result of wp_timezone_string
in a native php DateTimeZone
object. The wp_timezone_string
was also added in v5.3
.
Since this is a brand new plugin, I’m not going to support older version of WordPress. For pragmatic reasons, and in solidarity with the movement to encourage users to upgrade WP environments, I have also opted to not support versions of php (like v5.6
) that are past their End of Life.