Make WordPress Core

Changeset 55852


Ignore:
Timestamp:
05/24/2023 09:22:55 AM (12 months ago)
Author:
oandregal
Message:

Loading assets for the editor: Revert [55695].

The changeset [55695] introduced a regression in the order of styles for the editor, causing the styles registered for the block (both editor and front) to be loaded after any other styles enqueued using the enqueue_block_editor_assets hook.

Since the original behavior was introduced in WordPress 5.0 changing it breaks the expectations of the ecosystem.

Props ellatrix.
Fixes #58208.

File:
1 edited

Legend:

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

    r55821 r55852  
    572572add_action( 'enqueue_block_assets', 'wp_enqueue_registered_block_scripts_and_styles' );
    573573add_action( 'enqueue_block_assets', 'enqueue_block_styles_assets', 30 );
     574/*
     575 * `wp_enqueue_registered_block_scripts_and_styles` is bound to both
     576 * `enqueue_block_editor_assets` and `enqueue_block_assets` hooks
     577 * since the introduction of the block editor in WordPress 5.0.
     578 *
     579 * The way this works is that the block assets are loaded before any other assets.
     580 * For example, this is the order of styles for the editor:
     581 *
     582 * - front styles registered for blocks, via `styles` handle (block.json)
     583 * - editor styles registered for blocks, via `editorStyles` handle (block.json)
     584 * - editor styles enqueued via `enqueue_block_editor_assets` hook
     585 * - front styles enqueued via `enqueue_block_assets` hook
     586 */
     587add_action( 'enqueue_block_editor_assets', 'wp_enqueue_registered_block_scripts_and_styles' );
    574588add_action( 'enqueue_block_editor_assets', 'enqueue_editor_block_styles_assets' );
    575589add_action( 'enqueue_block_editor_assets', 'wp_enqueue_editor_block_directory_assets' );
Note: See TracChangeset for help on using the changeset viewer.