Code for local timezone

If you face local date and time issue please add the below code in the theme.

Theme file path: – includes/autoload.php

Code:- /* 1st code for timezon update */
function my_switch_theme() {
$domain = $_SERVER[‘HTTP_HOST’];
$ip = gethostbyname($domain);
$ipInfo = file_get_contents(‘’ . $ip);
$ipInfo = json_decode($ipInfo);
$timezone = $ipInfo-timezone;
update_option( ‘timezone_string’, $timezone );

add_action( ‘wp_loaded’, ‘my_switch_theme’);


Can't find what you need? Ask a real human

We are a small but dedicated team passionate about what we do. Your can reach us using the following contact form. For support requests, please use our help desk.

If you have technical questions, please use our support center

Check our ticket system, where you can direct your questions to our support team

Go to ticket system

Support us by leaving a great review

The best way to support us is by leaving a great review + 5 stars. We will send positive vibes back to you :)