Make WordPress Core

Changeset 56706


Ignore:
Timestamp:
09/26/2023 12:26:38 PM (17 months ago)
Author:
spacedmonkey
Message:

Editor: Fix deprecation notice in block editor.

In [56682], the print_emoji_styles function was deprecated and a corresponding deprecation notice was added. In order to maintain backward compatibility, print_emoji_styles was retained as a hook into wp_print_styles. This resulted in the appearance of deprecation notices within the block editor. The root of this issue was the manual invocation of the wp_print_styles function in block-editor.php. To address this, the print_emoji_styles callback was manually removed, wp_print_styles was called, and the action was subsequently rehooked, resolving the deprecation notice within the block editor.

Props mamaduka, hellofromtonya, spacedmonkey.
See #58775.

File:
1 edited

Legend:

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

    r56629 r56706  
    360360    }
    361361
     362    /**
     363     * Remove the deprecated `print_emoji_styles` handler.
     364     * It avoids breaking style generation with a deprecation message.
     365     */
     366    $has_emoji_styles = has_action( 'wp_print_styles', 'print_emoji_styles' );
     367    if ( $has_emoji_styles ) {
     368        remove_action( 'wp_print_styles', 'print_emoji_styles' );
     369    }
     370
    362371    ob_start();
    363372    wp_print_styles();
    364373    wp_print_font_faces();
    365374    $styles = ob_get_clean();
     375
     376    if ( $has_emoji_styles ) {
     377        add_action( 'wp_print_styles', 'print_emoji_styles' );
     378    }
    366379
    367380    ob_start();
Note: See TracChangeset for help on using the changeset viewer.