foreach ($blogs as $id) { switch_to_blog($id); $this->close_comments_in_db($types); restore_current_blog(); } } else { $this->close_comments_in_db($types); } } private function close_comments_in_db($types) { global $wpdb; $bits = implode(', ', array_pad(array(), count($types), '%s')); $wpdb->query($wpdb->prepare("UPDATE `{$wpdb->posts}` SET `comment_status` = 'closed', ping_status = 'closed' WHERE `post_type` IN ( {$bits} )", $types)); } private function persistent_mode_allowed() { if (defined('DISABLE_COMMENTS_ALLOW_PERSISTENT_MODE') && DISABLE_COMMENTS_ALLOW_PERSISTENT_MODE == false) { return false; } // The filter below is deprecated and will be removed in future versions. Use the define instead. return apply_filters('disable_comments_allow_persistent_mode', true); } public function single_site_deactivate() { // for single sites, delete the options upon deactivation, not uninstall delete_option('disable_comments_options'); } } Disable_Comments::get_instance();