Skip to content

Instantly share code, notes, and snippets.

@EdHurtig
Created July 14, 2014 20:07
Show Gist options
  • Save EdHurtig/728d9a4381b53a19b349 to your computer and use it in GitHub Desktop.
Save EdHurtig/728d9a4381b53a19b349 to your computer and use it in GitHub Desktop.
Updates the timezone on all WordPress sites to the specified PHP timezone
<?php
$timezone = 'America/New_York';
$blogs = wp_get_sites();
foreach ($blogs as $blog) {
switch_to_blog($blog['blog_id']);
echo 'Currently: ' . get_option('timezone_string') . ' for blog ' . $blog['blog_id'] . '<br />';
echo (update_option('timezone_string', $timezone) ? 'Updated' : 'Did Not Update') . '<br /><br/>';
restore_current_blog();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment