Skip to content

Commit

Permalink
Options, Meta APIs: Prevent mail options triggering a deprecation war…
Browse files Browse the repository at this point in the history
…ning.

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
  • Loading branch information
peterwilsoncc committed Sep 2, 2024
1 parent ab523eb commit 0ac256d
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions src/wp-admin/options.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,19 @@
$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';
Expand All @@ -180,7 +192,6 @@
$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';
}
Expand All @@ -198,17 +209,6 @@
$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 );
}
}

/**
Expand Down

0 comments on commit 0ac256d

Please sign in to comment.