Skip to content

Commit 5ce19d6

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

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

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

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1772,7 +1772,17 @@ 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(
1778+
$stashed_values,
1779+
function ( $setting_id ) {
1780+
return $this->get_setting( $setting_id );
1781+
},
1782+
ARRAY_FILTER_USE_KEY
1783+
);
1784+
1785+
$values = array_merge( $values, $valid_stashed_values );
17761786
}
17771787
}
17781788

0 commit comments

Comments
 (0)