Opened 4 months ago
Last modified 2 months ago
#48449 new defect (bug)
Parameters differ between instances of widget_comments_args filter
Reported by: | johnbillion | Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | normal | Version: | 5.0 |
Component: | Comments | Keywords: | needs-testing has-patch |
Focuses: | Cc: | ||
PR Number: |
Description
The widget_comments_args
filter is applied in two different places, but with different parameters:
- https://core.trac.wordpress.org/browser/tags/5.2.4/src/wp-includes/widgets/class-wp-widget-recent-comments.php?marks=99-107#L86
- https://core.trac.wordpress.org/browser/tags/5.2.4/src/wp-includes/blocks/latest-comments.php?marks=46-53#L35
Note that the second instance doesn't have access to an $instance
.
Attachments (1)
Change History (5)
@
2 months ago
Wp Recent Comments widget file updated to get rid of instance which is not needed anymore. This is so that the arguements are consistent
#2
@
2 months ago
- Keywords needs-testing added; needs-patch removed
I have attached the patch for the solution that I believe is good. The solution is to either add aninstance
argument for the filter in the file
which doesn't make any sense as we don't have any way to pass an instance. Looking at
https://core.trac.wordpress.org/browser/tags/5.2.4/src/wp-includes/widgets/class-wp-widget-recent-comments.php?marks=99-107#L86 , just removing instance from the parameters should solve and now we have the same consistent number of parameters in both calls.
#3
@
2 months ago
Thanks for the patch!
I don't think we can just remove the $instance
parameter from the filter, as that could cause backward compatibility issues and would be inconsistent with other widget filters, as seen in [41685].
I guess we can pass an empty array as $instance
in render_block_core_latest_comments()
, but that should be done upstream in the Gutenberg repository, per comment:5:ticket:48447.
Related: #38017