Last active
July 3, 2018 18:03
-
-
Save JRGould/4a2e7fa78d5be6abe8f91ce7be53f4ab to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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