Filter Image Sizes via WP REST
-
Hi,
We have an app we serve data from our WordPress website to via the REST API. This works great but we noticed recently that grabbing post images pulls in all of the different image sizes together which slows down post loading times.
Is it possible to create a custom endpoint that gets the same data as /wp/v2/media/(?P<id>[\d]+) but filters for the specific image size such as: /wp/v2/media/(?P<id>[\d]+)/(?S<size>[\d]+)/?
This would be ideal as we could then pull in just the size we want but still get all the rest of the data such as the image id, creation date etc.
Thank you!
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Filter Image Sizes via WP REST’ is closed to new replies.