Skip to content

Instantly share code, notes, and snippets.

@JRGould
Last active July 3, 2018 18:03
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 JRGould/4a2e7fa78d5be6abe8f91ce7be53f4ab to your computer and use it in GitHub Desktop.
Save JRGould/4a2e7fa78d5be6abe8f91ce7be53f4ab to your computer and use it in GitHub Desktop.
<?php
/*
Plugin Name: WP Migrate DB Pro Tweak: Skip Options
Plugin URI: http://github.com/deliciousbrains/wp-migrate-db-pro-tweaks
Description:
Author: Delicious Brains
Version: 1
Author URI: http://deliciousbrains.com
*/
// don't process data from $rows in options table
add_filter( 'wpmdb_pre_recursive_unserialize_replace', function($pre, $data, $wpmdb_replace ){
$options_to_skip = [
'wpml_notices',
'_wpml_dismissed_notices',
];
if ( false !== $pre ) {
return $pre;
}
if ( empty( $data ) ) {
return $pre;
}
if ( false === $wpmdb_replace->table_is( 'options' ) ) {
return $pre;
}
$row = $wpmdb_replace->get_row();
if ( ! isset( $row->option_name ) || ! in_array( $row->option_name, $options_to_skip ) ) {
return $pre;
}
return $data;
}, 10, 3 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment