Opened 3 years ago
Closed 3 years ago
#53757 closed defect (bug) (fixed)
Widget editor calls get_block_categories() with incorrect arg type
Reported by: | Enchiridion | Owned by: | audrasjb |
---|---|---|---|
Milestone: | 5.8.1 | Priority: | normal |
Severity: | normal | Version: | 5.8 |
Component: | Widgets | Keywords: | has-patch commit fixed-major |
Focuses: | Cc: |
Description
Just updated to 5.8.0 and found a couple issues with the new block widget editor while fixing all the new deprecated filters related to blocks.
\wp-admin\widgets-form-blocks.php:55
sprintf( 'wp.blocks.setCategories( %s );', wp_json_encode( get_block_categories( 'widgets-editor' ) ) ),
\wp-includes\class-wp-customize-widgets.php:865
sprintf( 'wp.blocks.setCategories( %s );', wp_json_encode( get_block_categories( 'widgets-customizer' ) ) ),
In these two places, get_block_categories()
is being passed a string instead of the required WP_Post
or WP_Block_Editor_Context
instance. The string is causing a fatal error due to the type hinting on my function for the block_categories_all
filter.
Change History (9)
This ticket was mentioned in PR #1532 on WordPress/wordpress-develop by pbearne.
3 years ago
#3
- Keywords has-patch added; needs-patch removed
Replaced 'widgets-customizer' and 'widgets-editor' with $block_editor context in get_block_categories() function calls
Trac ticket: https://core.trac.wordpress.org/ticket/53757
#5
@
3 years ago
- Keywords commit added
- Owner set to audrasjb
- Status changed from new to accepted
PR #1532 applies cleanly against trunk and fixes the issue on my side. Thanks for the PR!
Marking for commit consideration as this issue is clearly related to the widget editor and needs to be addressed in the next point release.
#7
@
3 years ago
- Keywords fixed-major added
- Resolution fixed deleted
- Status changed from closed to reopened
Reopening for backporting to the 5.8 branch.
SergeyBiryukov commented on PR #1532:
3 years ago
#8
Thanks for the PR! Merged in https://core.trac.wordpress.org/changeset/51700.
Good catch. It looks like we should replace
'widgets-customizer'
and'widgets-editor'
with$block_editor_context
variable on both files.