Make WordPress Core


Ignore:
Timestamp:
09/02/2024 12:11:39 AM (2 years ago)
Author:
peterwilsoncc
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/options.php

    r58425 r58963  
    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 */
     168if ( 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
    163175if ( ! is_utf8_charset() ) {
     
    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';
     
    198209                $allowed_options['media'][] = 'upload_path';
    199210                $allowed_options['media'][] = 'upload_url_path';
    200         }
    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 );
    211211        }
    212212}
Note: See TracChangeset for help on using the changeset viewer.