Skip to content

Instantly share code, notes, and snippets.

@ngearing
Last active June 20, 2018 00:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ngearing/7b3960d886a5ee711f8d30c2f0200867 to your computer and use it in GitHub Desktop.
Save ngearing/7b3960d886a5ee711f8d30c2f0200867 to your computer and use it in GitHub Desktop.
Bulk update WordPress options on ManageWP
<?php
$options = [
'theme_my_login' => [
'allow_update' => true,
'dismissed_notices' => true,
],
'wordpress_api_key' => '1', // Akismet API Key.
'akismet_comment_form_privacy_notice' => 'hide',
'akismet_strictness' => true,
];
foreach ( $options as $option_name => $option_data ) {
$option = get_option( $option_name );
if ( $option && is_array( $option ) ) {
$option_data = array_replace_recursive( $option, $option_data );
}
update_option( $option_name, $option_data );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment