Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save heyfletch/9e01cb3f7983c94d11934c1b075f3def to your computer and use it in GitHub Desktop.
Save heyfletch/9e01cb3f7983c94d11934c1b075f3def to your computer and use it in GitHub Desktop.
Prevent ACF Pro license key from being overwritten during WP Migrate DB Pro migration
<?php
/*
Based on https://gist.github.com/daltonrooney/470619cca87a6c29cb84f92d856b9ec1
and http://github.com/deliciousbrains/wp-migrate-db-pro-tweaks
*/
class ACF_WP_Migrate_DB_Pro_Tweaks {
function __construct() {
add_filter( 'wpmdb_preserved_options', array( $this, 'preserved_options' ) );
}
/**
* By default, 'wpmdb_settings' and 'wpmdb_error_log' are preserved when the database is overwritten in a migration.
* This filter allows you to define additional options (from wp_options) to preserve during a migration.
* The example below preserves the 'acf_pro_license' value though any number of additional options may be added.
*/
function preserved_options( $options ) {
$options[] = 'acf_pro_license';
return $options;
}
}
new ACF_WP_Migrate_DB_Pro_Tweaks();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment