Without comments, a website is as effective at creating a community as the Chicago Cubs are at winning World Series titles. WordPress 4.4 is a rebuilding release and the comments system is much improved under the hood.
This release lays the groundwork for future features and improvements.
A New Classy and Strong Comment Object
WP_Comment class provides a single organized comment object that models its row in
$wpdb->comments. You may be familiar with this approach from
WP_Post, which inspired the caching implementation used in
This was a prerequisite to many of the other comment-related bug fixes and features added in 4.4. The
WP_Comment class is marked final to retain flexibility while it is young.
Comment Queries for the Whole Family
WP_Comment_Query has new query parameters for traversing your comments family tree.
parent__in takes an array of comment parent IDs to return all matching children.
parent__not_in takes an array of comment parent IDs and does not return any matching children.
hierarchical can be set to either
threaded returns a tree for matched comments, with the children for each comment included in its
flat returns a flat array of matched comments plus their children.
false does not include descendants for matched comments. This is the default behavior.
orderby has a new option
comment__in, useful when querying by
comment__in the matched results will return in the same order.
See #8071 and #33882.