You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This function unsets the key you pass and then attempts to update the new settings array to the database.
// First let's grab the current settings
$options = get_option( 'edd_settings' );
// Next let's try to update the value
if( isset( $options[ $key ] ) ) {
unset( $options[ $key ] );
}
$did_update = update_option( 'edd_settings', $options );
This is all fine and well, but the issue is in updating the option. edd_settings_sanitize() is hooked into updating this option and there's a line in there that is problematic:
// Merge our new settings with the existing
$output = array_merge( $edd_options, $input );
The issue is that the global $edd_options used here still contains the value we're trying to delete. So by merging, we're simply adding that value back into the settings. This completely overrides what edd_delete_option() is trying to do. It seems that the simple fix is to unset this key from the global within edd_delete_option(). So like this:
global $edd_options;
// First let's grab the current settings
$options = get_option( 'edd_settings' );
// Next let's try to update the value
if( isset( $options[ $key ] ) ) {
unset( $options[ $key ] );
}
if( isset( $edd_options[ $key ] ) ) {
unset( $edd_options[ $key ] );
}
$did_update = update_option( 'edd_settings', $options );
The text was updated successfully, but these errors were encountered:
This function unsets the key you pass and then attempts to update the new settings array to the database.
This is all fine and well, but the issue is in updating the option.
edd_settings_sanitize()
is hooked into updating this option and there's a line in there that is problematic:The issue is that the global
$edd_options
used here still contains the value we're trying to delete. So by merging, we're simply adding that value back into the settings. This completely overrides whatedd_delete_option()
is trying to do. It seems that the simple fix is to unset this key from the global withinedd_delete_option()
. So like this:The text was updated successfully, but these errors were encountered: