Make WordPress Core

Changeset 51700


Ignore:
Timestamp:
08/31/2021 01:37:31 PM (3 years ago)
Author:
SergeyBiryukov
Message:

Widgets: Pass correct context to get_block_categories() calls.

The get_block_categories() function expects either a WP_Post or a WP_Block_Editor_Context instance as the context argument, not a string.

Follow-up to [50996], [50997].

Props Enchiridion, pbearne, audrasjb.
Fixes #53757.

Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/widgets-form-blocks.php

    r51202 r51700  
    5353wp_add_inline_script(
    5454    'wp-blocks',
    55     sprintf( 'wp.blocks.setCategories( %s );', wp_json_encode( get_block_categories( 'widgets-editor' ) ) ),
     55    sprintf( 'wp.blocks.setCategories( %s );', wp_json_encode( get_block_categories( $block_editor_context ) ) ),
    5656    'after'
    5757);
  • trunk/src/wp-includes/class-wp-customize-widgets.php

    r51423 r51700  
    863863            wp_add_inline_script(
    864864                'wp-blocks',
    865                 sprintf( 'wp.blocks.setCategories( %s );', wp_json_encode( get_block_categories( 'widgets-customizer' ) ) ),
     865                sprintf( 'wp.blocks.setCategories( %s );', wp_json_encode( get_block_categories( $block_editor_context ) ) ),
    866866                'after'
    867867            );
Note: See TracChangeset for help on using the changeset viewer.