Opened 7 years ago
Last modified 4 years ago
#41740 new enhancement
Add comment count to "replies" link in post responses
Reported by: | rmccue | Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | normal | Version: | |
Component: | REST API | Keywords: | |
Focuses: | Cc: |
Description
Right now, you can preload comments using embedding with the linked "replies" resource. This is great, but there's no way to know whether you should try loading more. Fetching the resource directly would give you the total in the X-WP-Total
header, but you lose this when embedding.
While this is generically a problem with the loss of headers from embedded resources, I don't think we really need a generic solution. Even when not embedding, a comment count is useful for archive display of a list of posts.
We should add the comment count (using wp_count_comments
) to the "replies" link:
{ "replies": [ { "href": ".../wp/v2/comments?post=42", "embeddable": true, "count": 12, } ] }
Attachments (1)
Change History (3)
Note: See
TracTickets for help on using
tickets.
I can look at this as my first bug :)