WordPress.org

Make WordPress Core

Changeset 51711


Ignore:
Timestamp:
09/01/2021 12:33:28 AM (3 weeks ago)
Author:
desrosj
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, SergeyBiryukov.
Merges [51700] to the 5.8 branch.
Fixes #53757.

Location:
branches/5.8
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/5.8

  • branches/5.8/src/wp-admin/widgets-form-blocks.php

    r51202 r51711  
    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);
  • branches/5.8/src/wp-includes/class-wp-customize-widgets.php

    r51424 r51711  
    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.