[wp-trac] [WordPress Trac] #63928: Add additional fields to the `/wp-json/wp/v2/comments` endpoints
WordPress Trac
noreply at wordpress.org
Thu Sep 4 18:15:48 UTC 2025
#63928: Add additional fields to the `/wp-json/wp/v2/comments` endpoints
--------------------------------------+------------------------------
Reporter: hannahtinkler | Owner: hannahtinkler
Type: enhancement | Status: assigned
Priority: normal | Milestone: Awaiting Review
Component: REST API | Version: trunk
Severity: normal | Resolution:
Keywords: has-patch has-unit-tests | Focuses: rest-api
--------------------------------------+------------------------------
Comment (by hannahtinkler):
Thanks for the feedback @swissspidy!
> > `can_moderate`
>
> Can't this be determined through other means, e.g. `_links` or HTTP
headers?
I can't see anything in `_links` that would indicate the authenticated
user is able to edit the given comment - have I misunderstood?
Any HTTP headers would apply to the whole request so I don't think it
would be a reliable indicator that the authenticated user can edit any one
specific comment returned in the response. Ability to edit a specific
comment may depend on a number of factors including whether the user is an
admin, the comment author, or some custom logic applied through filters
like `user_has_cap`.
> > `post_details`
>
> Ditto here, can't this be done by embedding the `up` link?
Do you mean re-using the `_links.up.href` value for `post_details.link` in
the response, or using the `_links.up.href` value in the app to request
the post information?
> > `i_replied`
> There might be a more RESTful approach for this as well. For example,
there's already a `children` link — perhaps we could add a similar link
just for children by the current user.
Comments render in the WordPress app in a list; the team's intention is to
use this data in a the list along side each comment. Supplying a link to
retrieve the children belonging to the current user would require the app
to make an extra call per comment displayed, which would not be ideal for
performance or network usage.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/63928#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list