[wp-trac] [WordPress Trac] #63928: Add additional fields to the `/wp-json/wp/v2/comments` endpoints
WordPress Trac
noreply at wordpress.org
Thu Sep 11 11:00:17 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 all for your patience and the additional context - I appreciate it!
🙏
> `targetHints` are also a new addition in 6.7
This will be super useful; I can see it maps back to the controller
permissions callbacks so would be more robust than just a
`current_user_can` call anyway.
> I'm definitely also mindful of extra HTTP requests, which is why I
suggested to use linking and embedding.
TIL! The embedding feature is really cool, I hadn't seen that in WordPress
before. I share Tony's concerns about response size though - although the
post content is excluded, my requests are almost double the size using
`?_embed=up`.
@swisspiddy / @rmccue / anyone else: Looking at the code, there doesn't
seem to be a way to customise the embed fields that are returned (e.g.
like you would for a direct request with `?fields=`) except for providing
a different context via the `_links` hrefs - am I reading that correctly?
I'm assuming that adding a `_links` entry either for just the post title,
or for an additional `up` context, wouldn't be encouraged. Likewise for
adding a reduced, app-specific embed context (even if there ''was'' some
way to pass a context to the embed code without changing the `_links`
href). My only other thought was around being able to specify which embed
fields should be returned, but that would obviously defeat the point of
contexts, and would be a very non-trivial change in how the REST API
works.
I'd be interested to hear any other thoughts on how we might be able to
solve this without additional request(s) or increasing the response size,
if anyone has any - I'm not seeing anything else at the moment 😕
--
Ticket URL: <https://core.trac.wordpress.org/ticket/63928#comment:9>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list