Options: Unhook default option filter when setting is unregistered.

Fixes #43207.


git-svn-id: https://develop.svn.wordpress.org/trunk@42655 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Felix Arntz
2018-02-06 14:48:46 +00:00
parent e04b4d47b4
commit ea13c56d7f
2 changed files with 20 additions and 0 deletions

View File

@@ -2182,6 +2182,11 @@ function unregister_setting( $option_group, $option_name, $deprecated = '' ) {
remove_filter( "sanitize_option_{$option_name}", $wp_registered_settings[ $option_name ]['sanitize_callback'] );
}
// Remove the default filter if a default was provided during registration.
if ( array_key_exists( 'default', $wp_registered_settings[ $option_name ] ) ) {
remove_filter( "default_option_{$option_name}", 'filter_default_option', 10 );
}
unset( $wp_registered_settings[ $option_name ] );
}
}