Make WordPress Core


Ignore:
Timestamp:
02/27/2023 05:30:07 PM (2 years ago)
Author:
flixos90
Message:

Twenty Twenty: Avoid PHP warnings in 8.1 due to incorrect usage of wp_add_inline_style().

This changeset adjusts the logic to use a more defensive approach, to avoid passing potentially invalid values to wp_add_inline_style().

Props flixos90, mukesh27, costdev, swissspidy, poena, sabernhardt.
Fixes #57777.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-content/themes/twentytwenty/classes/class-twentytwenty-non-latin-languages.php

    r54314 r55427  
    2626         *
    2727         * @param string $type Whether to return CSS for the "front-end", "block-editor", or "classic-editor".
    28          * @return void
     28         * @return string|null Custom CSS, or null if not applicable.
    2929         */
    3030        public static function get_non_latin_css( $type = 'front-end' ) {
     
    106106            // Return if the selected language has no fallback fonts.
    107107            if ( empty( $font_family[ $locale ] ) ) {
    108                 return;
     108                return null;
    109109            }
    110110
     
    127127            // Return if the specified type doesn't exist.
    128128            if ( empty( $elements[ $type ] ) ) {
    129                 return;
     129                return null;
    130130            }
    131131
Note: See TracChangeset for help on using the changeset viewer.