Skip to content

Commit 0ac256d

Browse files
committed
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. git-svn-id: https://develop.svn.wordpress.org/trunk@58963 602fd350-edb4-49c9-b593-d223f7449a82
1 parent ab523eb commit 0ac256d

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

src/wp-admin/options.php

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,19 @@
158158
$allowed_options['options'] = array();
159159
$allowed_options['privacy'] = array();
160160

161-
$mail_options = array( 'mailserver_url', 'mailserver_port', 'mailserver_login', 'mailserver_pass' );
161+
/**
162+
* Filters whether the post-by-email functionality is enabled.
163+
*
164+
* @since 3.0.0
165+
*
166+
* @param bool $enabled Whether post-by-email configuration is enabled. Default true.
167+
*/
168+
if ( apply_filters( 'enable_post_by_email_configuration', true ) ) {
169+
$allowed_options['writing'][] = 'mailserver_url';
170+
$allowed_options['writing'][] = 'mailserver_port';
171+
$allowed_options['writing'][] = 'mailserver_login';
172+
$allowed_options['writing'][] = 'mailserver_pass';
173+
}
162174

163175
if ( ! is_utf8_charset() ) {
164176
$allowed_options['reading'][] = 'blog_charset';
@@ -180,7 +192,6 @@
180192
$allowed_options['general'][] = 'users_can_register';
181193
$allowed_options['general'][] = 'default_role';
182194

183-
$allowed_options['writing'] = array_merge( $allowed_options['writing'], $mail_options );
184195
if ( '1' === get_option( 'blog_public' ) ) {
185196
$allowed_options['writing'][] = 'ping_sites';
186197
}
@@ -198,17 +209,6 @@
198209
$allowed_options['media'][] = 'upload_path';
199210
$allowed_options['media'][] = 'upload_url_path';
200211
}
201-
} else {
202-
/**
203-
* Filters whether the post-by-email functionality is enabled.
204-
*
205-
* @since 3.0.0
206-
*
207-
* @param bool $enabled Whether post-by-email configuration is enabled. Default true.
208-
*/
209-
if ( apply_filters( 'enable_post_by_email_configuration', true ) ) {
210-
$allowed_options['writing'] = array_merge( $allowed_options['writing'], $mail_options );
211-
}
212212
}
213213

214214
/**

0 commit comments

Comments
 (0)