WordPress.org

Make WordPress Core

Opened 2 years ago

Last modified 6 days 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:
PR Number:

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)

41740.diff (489 bytes) - added by wongalex 12 months ago.

Download all attachments as: .zip

Change History (3)

#1 @wongalex
12 months ago

I can look at this as my first bug :)

EDIT: Actually I looked through and it's just a one line change with the change being above haha. Ignore this.

Last edited 12 months ago by wongalex (previous) (diff)

@wongalex
12 months ago

#2 @belindaccarthy
6 days ago

Add comment count to replies link in post responses and description is also here. I can make them perfect but not all for dissertation writing service uk is defined here. I know that not with all these reasons you can start to do work on these responses ever. But you have to take them for only you.

Note: See TracTickets for help on using tickets.