[wp-trac] [WordPress Trac] #46963: Comments meta box offset bug for custom comment types
WordPress Trac
noreply at wordpress.org
Wed Apr 17 13:13:40 UTC 2019
#46963: Comments meta box offset bug for custom comment types
----------------------------+-----------------------------
Reporter: mikejolley | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Administration | Version:
Severity: normal | Keywords:
Focuses: |
----------------------------+-----------------------------
There is a conflict in the 'comments' meta box when used in combination
with custom comment types.
The `Show more comments` link loads duplicates, without an offset due to
this line of code:
https://github.com/WordPress/WordPress/blob/72979b167d913bf49745fa737654bdf6d13168de
/wp-admin/js/post.js#L99
{{{
this.st = jQuery('#the-comment-list tr.comment:visible').length;
}}}
For custom comment types, the `comment` class may not exist. See how
comment classes are generated here:
https://github.com/WordPress/WordPress/blob/03240dd3f4442546562824bc6a10ed7c197bd6b2
/wp-includes/comment-template.php#L466
{{{#!php
<?php
$classes[] = ( empty( $comment->comment_type ) ) ? 'comment' :
$comment->comment_type;
}}}
You can see an example of this with WooCommerce which uses a comment type
named 'review' (https://github.com/woocommerce/woocommerce/issues/23313).
Because the comments out output without the `comment` class and instead
they have a `review` class, the JS code fails to set the correct offset.
Possible solutions:
- Output `comment` class for custom comment types in addition to their
custom class.
- Revise jquery selector to be more generic e.g. count the `tr` elements
instead.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/46963>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list