Make WordPress Core

Changeset 53784


Ignore:
Timestamp:
07/27/2022 12:25:06 PM (2 years ago)
Author:
gziolo
Message:

Site Editor: Pass correct context into get_block_categories

Site Editor passed incorrectly global $post as a context when setting up block categories. Instead, it should pass $block_editor_context, since global $post is null in this file.

Props Mamaduka.
Fixes #56284.

File:
1 edited

Legend:

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

    r53441 r53784  
    77 */
    88
    9 global $post, $editor_styles;
     9global $editor_styles;
    1010
    1111/** WordPress Administration Bootstrap */
     
    121121wp_add_inline_script(
    122122    'wp-blocks',
    123     sprintf( 'wp.blocks.setCategories( %s );', wp_json_encode( get_block_categories( $post ) ) ),
     123    sprintf( 'wp.blocks.setCategories( %s );', wp_json_encode( isset( $editor_settings['blockCategories'] ) ? $editor_settings['blockCategories'] : array() ) ),
    124124    'after'
    125125);
Note: See TracChangeset for help on using the changeset viewer.