Filter comments_array
not called in render_block_core_comment_template()
#47655
Labels
[Block] Comment Template
Affects the Comment Template Block
[Type] Enhancement
A suggestion for improvement.
Description
This is the code for
render_block_core_comment_template()
in block_library/comment_template/index.php:That doesn't allow a plugin author to provide a custom ordering. In my case I am adding comment voting and we want to reorder comments by their up/down votes. The following line should be inserted prior to the
$wrapper_attributes
assignment:Step-by-step reproduction instructions
add_filter( 'comments_array', function ( $comments, $post_id ) { return array_reverse( $comments ); }, 10, 2 );
Screenshots, screen recording, code snippet
No response
Environment info
Wordpress version: 6.1.1, Gutenberg version: Unknown but it matches git, Theme: Twenty TwentyThree
Browser: Chrome, but not pertinent
Device: Host is linux, viewed on linux, Windows, and Android
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Yes
The text was updated successfully, but these errors were encountered: