Fix 'Show more comments' button in comments metabox not working for custom comment types#12055
Conversation
…ustom comment types
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
|
There are some PHPUnit Tests automations failing, but they don't seem related. |
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Right now, the comments metabox in WordPress assumes all comments
<tr>elements will have thecommentclass. But that's not true if the comment type is custom, like WooCommerce's reviews.This PR makes the selector match the
<tr>elements by their id starting withcomment-, this seems to be a safer approach because it matches regular comments and other comment types like reviews.It also changes the default number of reviews which are requested in the AJAX call. Until now, it was
20, but the backend was falling back to10, causing an inconsistency that made the frontend think all comments were already loaded even if they weren't.Trac ticket: https://core.trac.wordpress.org/ticket/65392.
Initial report in WooCommerce repo: woocommerce/woocommerce#52731.
Also kudos to @PavloBorysenko for the initial research in woocommerce/woocommerce#52731 (comment).
Use of AI Tools
AI assistance: Yes
Tool(s): Cursor
Model(s): Composer
Used for: Researching the code, brainstorming solutions and writing steps to reproduce.
Steps to reproduce (custom code)
Steps to reproduce (WooCommerce)
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.