How to set blog time in Script w/o date_default_timezone_set
-
I have a homegrown WordPress plugin that has always used “date_default_timezone_set” to set the script to work at the same timezone as the WP blog is set for.
Current code:
{ if ( $timezone = get_option( 'timezone_string' ) ) return $timezone; } date_default_timezone_set(wp_get_timezone_string());
Although the plugin and the websites still work fine, the WordPress dashboards now report the use of “date_default_timezone_set” as a critical issue.
I need a new way to set the timezone in the script to match whatever zone the WP site is set for. But I can’t find reference to that anywhere, and experimentation hasn’t done it. I know others have solved this new issue, but I haven’t been able to find the solution.
How to I set my php script to use whatever timezone the WP website is set for?
- The topic ‘How to set blog time in Script w/o date_default_timezone_set’ is closed to new replies.