[wp-trac] [WordPress Trac] #41740: Add comment count to "replies" link in post responses

WordPress Trac noreply at wordpress.org
Mon Aug 28 02:42:11 UTC 2017


#41740: Add comment count to "replies" link in post responses
-------------------------+-----------------------------
 Reporter:  rmccue       |      Owner:
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  Awaiting Review
Component:  REST API     |    Version:
 Severity:  normal       |   Keywords:
  Focuses:               |
-------------------------+-----------------------------
 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,
         }
     ]
 }
 }}}

--
Ticket URL: <https://core.trac.wordpress.org/ticket/41740>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list