Skip to content

Instantly share code, notes, and snippets.

@corradomatt
Last active November 23, 2020 18:39
Show Gist options
  • Save corradomatt/8941712 to your computer and use it in GitHub Desktop.
Save corradomatt/8941712 to your computer and use it in GitHub Desktop.
The settings for Migrate-DB-Pro plugin to exclude Better WordPress Security, WooCommerce SSL and WooCommerce Plugin Activation settings when pushing or pulling your database. This code DOES NOT work as a stand-alone gist. You will need to utilize it within this code - https://github.com/deliciousbrains/wp-migrate-db-pro-tweaks/
/**
* Exclude certain WordPress database settings from being migrated when pushing or pulling
* with Migrate-DB-Pro
*
* Useful when developing locally and wanting to push or pull database settings between envirnments
* USE CAUTION! - Must be used with https://github.com/deliciousbrains/wp-migrate-db-pro-tweaks/
*/
function preserved_options( $options ) {
$options[] = 'blog_public'; // discourage search engines setting
$options[] = 'bit51_bwps'; // Better WordPress Security Settings
$options[] = 'bit51_bwps_data'; // Better WordPress Security Data (not sure if this is necessary)
$options[] = 'woocommerce_force_ssl_checkout'; // Using SSL within WooCommerce
$options[] = 'woocommerce_unforce_ssl_checkout'; // Unforcing SSL within WooCommerce
$options[] = 'woothemes-updater-activated'; // WooCommerce Plugin Activation Codes
return $options;
}
@khoallaby
Copy link

khoallaby commented Nov 16, 2020

no need for the extra plugin/code.... just add the function into the correct filter, wpmdb_preserved_options

add_filter( 'wpmdb_preserved_options', function($options) {
    $options[] = 'blog_public'; // discourage search engines setting
    return $options;
} );

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment