Skip to content

Commit

Permalink
WPCOM API: Return actual value instead of bool for some settings afte…
Browse files Browse the repository at this point in the history
…r update (#38498)
  • Loading branch information
pkuliga authored Jul 25, 2024
1 parent 31821a6 commit b8ae589
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: other

WPCOM API: Return actual value instead of bool for some settings after update
Original file line number Diff line number Diff line change
Expand Up @@ -1005,7 +1005,9 @@ function ( &$value ) {
break;

case 'rss_use_excerpt':
update_option( 'rss_use_excerpt', (int) (bool) $value );
$sanitized_value = (int) (bool) $value;
update_option( $key, $sanitized_value );
$updated[ $key ] = $sanitized_value;
break;

case 'wpcom_subscription_emails_use_excerpt':
Expand All @@ -1016,16 +1018,19 @@ function ( &$value ) {
case 'jetpack_subscriptions_reply_to':
require_once JETPACK__PLUGIN_DIR . 'modules/subscriptions/class-settings.php';
$to_set_value = Automattic\Jetpack\Modules\Subscriptions\Settings::is_valid_reply_to( $value )
? $value
? (string) $value
: Automattic\Jetpack\Modules\Subscriptions\Settings::get_default_reply_to();

update_option( 'jetpack_subscriptions_reply_to', (string) $to_set_value );
$updated[ $key ] = (bool) $value;
if ( update_option( $key, $to_set_value ) ) {
$updated[ $key ] = $to_set_value;
}
break;

case 'jetpack_subscriptions_from_name':
$to_set_value = sanitize_text_field( $value );
update_option( 'jetpack_subscriptions_from_name', (string) $to_set_value );
$updated[ $key ] = (bool) $value;
$sanitized_value = sanitize_text_field( $value );
if ( update_option( $key, $sanitized_value ) ) {
$updated[ $key ] = $sanitized_value;
}
break;

case 'instant_search_enabled':
Expand Down

0 comments on commit b8ae589

Please sign in to comment.