#43212 closed defect (bug) (fixed)
In WP Posts List Table class, comment_pending_count is calculated even if post_type does not support comments
Reported by: | seanchayes | Owned by: | SergeyBiryukov |
---|---|---|---|
Milestone: | 5.1 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Posts, Post Types | Keywords: | has-patch needs-testing |
Focuses: | administration | Cc: |
Description
When viewing a list of Posts or post_type
's in WP Admin the WP Posts List Table class always calculates the get_pending_comments_num()
without checking if the post type being listed has 'comments' support. This generates an unnecessary and unused query to the database.
I propose adding a post_type_supports
check at this time to see if the post type support comments. If it does then calculate the pending comments num and if it does not then skip over the get_pending_comments_num()
function call and do not calculate the pending comments num.
I have put together a patch that addresses this issue and will attach it to this ticket.
Attachments (1)
Change History (5)
Note: See
TracTickets for help on using
tickets.
In 42638: