Skip to content

Instantly share code, notes, and snippets.

@noameppel
Last active December 28, 2015 06:09
Show Gist options
  • Select an option

  • Save noameppel/7455245 to your computer and use it in GitHub Desktop.

Select an option

Save noameppel/7455245 to your computer and use it in GitHub Desktop.
WordPress Update Options Across WordPress Multisite Example of how to update thumbnail_crop across a WordPress Multisite.
<?php
define('WP_USE_THEMES', false);
require('../wp-blog-header.php');
require_once( ABSPATH . '/wp-includes/pluggable.php');
$setting = 'thumbnail_crop'; //the setting you want to update.
$newvalue = '1'; //the new value
echo "<h2>Member Sites</h2>";
$allsites = wp_get_sites('limit=0');
echo "<pre>";
foreach ($allsites as $value) {
echo $value['domain'] . " - (blog_id: " . $value['blog_id'] . ") <br />";
$currentsetting = get_blog_option( $value['blog_id'], $setting, false );
echo "Current Setting: $currentsetting <br />";
update_blog_option($value['blog_id'], $setting, $newvalue);
}
echo "<h2>Member Sites Details</h2>";
print_r($allsites);
echo "</pre>";
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment