From 6ad25bf454a83d4112466b14ff7a59532bdbfb69 Mon Sep 17 00:00:00 2001 From: Enrico Battocchi Date: Fri, 3 May 2024 13:30:44 +0200 Subject: [PATCH 1/2] Remove duplicated validation when cleaning `wpseo_titles` options --- inc/options/class-wpseo-option-titles.php | 40 ----------------------- 1 file changed, 40 deletions(-) diff --git a/inc/options/class-wpseo-option-titles.php b/inc/options/class-wpseo-option-titles.php index 24fa03b333b..ff613e48ea0 100644 --- a/inc/options/class-wpseo-option-titles.php +++ b/inc/options/class-wpseo-option-titles.php @@ -874,46 +874,6 @@ protected function clean_option( $option_value, $current_version = null, $all_ol unset( $rename, $taxonomy_names, $post_type_names, $defaults, $tax, $old_prefix, $new_prefix ); } - /* - * Make sure the values of the variable option key options are cleaned as they - * may be retained and would not be cleaned/validated then. - */ - if ( is_array( $option_value ) && $option_value !== [] ) { - foreach ( $option_value as $key => $value ) { - $switch_key = $this->get_switch_key( $key ); - - // Similar to validation routine - any changes made there should be made here too. - switch ( $switch_key ) { - /* Text fields. */ - case 'title-': - case 'metadesc-': - case 'bctitle-ptarchive-': - $option_value[ $key ] = WPSEO_Utils::sanitize_text_field( $value ); - break; - - case 'separator': - if ( ! array_key_exists( $value, $this->get_separator_options() ) ) { - $option_value[ $key ] = false; - } - break; - - /* - * Boolean fields. - */ - - /* - * Covers: - * 'noindex-' - * 'hideeditbox-' - */ - default: - $option_value[ $key ] = WPSEO_Utils::validate_bool( $value ); - break; - } - } - unset( $key, $value, $switch_key ); - } - return $option_value; } From 23b32fa0a395d2ebce6fbbd40348e8e5b1149265 Mon Sep 17 00:00:00 2001 From: Enrico Battocchi Date: Fri, 3 May 2024 13:31:17 +0200 Subject: [PATCH 2/2] Settings: don't disable the image selection when there is media error --- .../js/src/settings/components/formik-media-select-field.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/js/src/settings/components/formik-media-select-field.js b/packages/js/src/settings/components/formik-media-select-field.js index 20dc3e41091..b021f696002 100644 --- a/packages/js/src/settings/components/formik-media-select-field.js +++ b/packages/js/src/settings/components/formik-media-select-field.js @@ -63,7 +63,7 @@ const FormikMediaSelectField = ( { const fallbackMedia = useSelectSettings( "selectMediaById", [ fallbackMediaId ], fallbackMediaId ); const { fetchMedia, addOneMedia } = useDispatchSettings(); const error = useMemo( () => get( errors, mediaIdName, "" ), [ errors, mediaIdName ] ); - const disabled = useMemo( () => isDisabled || isDummy || isMediaError, [ isDummy, isDisabled, isMediaError ] ); + const disabled = useMemo( () => isDisabled || isDummy, [ isDummy, isDisabled ] ); const { ids: describedByIds, describedBy } = useDescribedBy( `field-${ id }-id`, { description, error } ); const previewMedia = useMemo( () => { if ( mediaId > 0 ) {