Make WordPress Core


Ignore:
Timestamp:
08/27/2020 09:37:33 PM (4 years ago)
Author:
SergeyBiryukov
Message:

Bootstrap/Load: Check if the __() function is available in wp_get_environment_type().

The function would not exist in SHORTINIT mode.

Follow-up to [48894].

See #50992.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/load.php

    r48894 r48895  
    160160    // Add a note about the deprecated WP_ENVIRONMENT_TYPES constant.
    161161    if ( defined( 'WP_ENVIRONMENT_TYPES' ) && function_exists( '_deprecated_argument' ) ) {
     162        if ( function_exists( '__' ) ) {
     163            /* translators: %s: WP_ENVIRONMENT_TYPES */
     164            $message = sprintf( __( 'The %s constant is no longer supported.' ), 'WP_ENVIRONMENT_TYPES' );
     165        } else {
     166            $message = sprintf( 'The %s constant is no longer supported.', 'WP_ENVIRONMENT_TYPES' );
     167        }
     168
    162169        _deprecated_argument(
    163170            'define()',
    164171            '5.5.1',
    165             /* translators: %s: WP_ENVIRONMENT_TYPES */
    166             sprintf( __( 'The %s constant is no longer supported.' ), 'WP_ENVIRONMENT_TYPES' )
     172            $message
    167173        );
    168174    }
Note: See TracChangeset for help on using the changeset viewer.