Skip to content

Commit 6ccb9c4

Browse files
author
Alessandro Lioce
committed
Customizer: Prevent saving orphaned settings after plugin deactivation. See #64231.
1 parent 49b38e9 commit 6ccb9c4

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/wp-includes/class-wp-customize-manager.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1772,7 +1772,13 @@ public function unsanitized_post_values( $args = array() ) {
17721772
$stashed_theme_mods = get_option( 'customize_stashed_theme_mods' );
17731773
$stylesheet = $this->get_stylesheet();
17741774
if ( isset( $stashed_theme_mods[ $stylesheet ] ) ) {
1775-
$values = array_merge( $values, wp_list_pluck( $stashed_theme_mods[ $stylesheet ], 'value' ) );
1775+
$stashed_values = wp_list_pluck( $stashed_theme_mods[ $stylesheet ], 'value' );
1776+
1777+
$valid_stashed_values = array_filter( $stashed_values, function ( $setting_id ) {
1778+
return $this->get_setting( $setting_id );
1779+
}, ARRAY_FILTER_USE_KEY );
1780+
1781+
$values = array_merge( $values, $valid_stashed_values );
17761782
}
17771783
}
17781784

0 commit comments

Comments
 (0)