Created
December 2, 2015 21:51
-
-
Save vaughanm/f3b84072bb927eab8311 to your computer and use it in GitHub Desktop.
Sets comments to registered users only across entire network (multisite)
This file contains 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
function wpmudev_change_comment_settings() { | |
global $wpdb; | |
| |
$blog_ids = wp_get_sites(); | |
| |
foreach($blog_ids as $blog) { | |
switch_to_blog($blog['blog_id']); | |
$wpdb->query("UPDATE {$wpdb->prefix}options SET option_value = 1 WHERE option_name = 'comment_registration'"); | |
restore_current_blog(); | |
} | |
} | |
add_action('admin_init', 'wpmudev_change_comment_settings'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This mu-plugin is to be used to set comments to be only registered users only across the entire multisite network in 1 go.
Add the mu-plugin, then visit the dashboard on your multisite.
Once done, remove the mu-plugin.