Add featured +- attached images to post endpoint in REST API

When one pulls up the endpoint “wp-json/wp/v2/posts” we get a key called “featured_media” but it returns an integer value.

Can’t we rewrite this to give a proper URL to the featured image? or even add another key that has attached images as URLs.

This will prevent the extra queries one has to return the image URLs or even install bloated plugins to get this information.

I know the endpoint already has so much information one rarely needs thus the growth of tech like GraphQL but we could also consider Author name & description to the individual posts.

This is voice is for decoupling ClassicPress to modern apps or front-ends.


Read-only archive: https://petitions.classicpress.net/posts/120/add-featured-attached-images-to-post-endpoint-in-rest-api

Author: Laurence Bahiirwa

Vote count: 5

Status: open

Tags:

  • difficulty-hard
  • request-add-feature

Comments