Last active
December 28, 2015 06:09
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?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