From 4fc2975cb5e5ff65bc70071491d41ccdcb84b4fb Mon Sep 17 00:00:00 2001 From: Peter Wilson Date: Mon, 2 Sep 2024 00:13:16 +0000 Subject: [PATCH] Options, Meta APIs: Prevent mail options triggering a deprecation warning. Prevents a deprecation warning saving options when the post by email feature is turned off in code using the `enable_post_by_email_configuration` filter. Props ironprogrammer, manbo, narenin, sebastienserre, siliconforks. Fixes #61144. Built from https://develop.svn.wordpress.org/trunk@58963 git-svn-id: http://core.svn.wordpress.org/trunk@58359 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/options.php | 26 +++++++++++++------------- wp-includes/version.php | 2 +- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/wp-admin/options.php b/wp-admin/options.php index 6916e2e25c..8348b24c8e 100644 --- a/wp-admin/options.php +++ b/wp-admin/options.php @@ -158,7 +158,19 @@ $allowed_options['misc'] = array(); $allowed_options['options'] = array(); $allowed_options['privacy'] = array(); -$mail_options = array( 'mailserver_url', 'mailserver_port', 'mailserver_login', 'mailserver_pass' ); +/** + * Filters whether the post-by-email functionality is enabled. + * + * @since 3.0.0 + * + * @param bool $enabled Whether post-by-email configuration is enabled. Default true. + */ +if ( apply_filters( 'enable_post_by_email_configuration', true ) ) { + $allowed_options['writing'][] = 'mailserver_url'; + $allowed_options['writing'][] = 'mailserver_port'; + $allowed_options['writing'][] = 'mailserver_login'; + $allowed_options['writing'][] = 'mailserver_pass'; +} if ( ! is_utf8_charset() ) { $allowed_options['reading'][] = 'blog_charset'; @@ -180,7 +192,6 @@ if ( ! is_multisite() ) { $allowed_options['general'][] = 'users_can_register'; $allowed_options['general'][] = 'default_role'; - $allowed_options['writing'] = array_merge( $allowed_options['writing'], $mail_options ); if ( '1' === get_option( 'blog_public' ) ) { $allowed_options['writing'][] = 'ping_sites'; } @@ -198,17 +209,6 @@ if ( ! is_multisite() ) { $allowed_options['media'][] = 'upload_path'; $allowed_options['media'][] = 'upload_url_path'; } -} else { - /** - * Filters whether the post-by-email functionality is enabled. - * - * @since 3.0.0 - * - * @param bool $enabled Whether post-by-email configuration is enabled. Default true. - */ - if ( apply_filters( 'enable_post_by_email_configuration', true ) ) { - $allowed_options['writing'] = array_merge( $allowed_options['writing'], $mail_options ); - } } /** diff --git a/wp-includes/version.php b/wp-includes/version.php index 664cb7e551..6453748ba7 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.7-alpha-58962'; +$wp_version = '6.7-alpha-58963'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.