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
This commit is contained in:
Peter Wilson 2024-09-02 00:13:16 +00:00
parent 8532edd526
commit 4fc2975cb5
2 changed files with 14 additions and 14 deletions

View File

@ -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 );
}
}
/**

View File

@ -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.