Retrieve category with its images via REST API
-
Hi there! I’ve been through several plugins trying to find the one that fits my needs the best, and I’m thinking this one might be the one if I can get this one thing figured out.
I’m creating a photography portfolio site, so each category (aka gallery) contains images. What I’d like to do is return all of the categories with their images in one call. Is this possible?
When I make a request to “{{base_url}}/wp/v2/media”, I can see the id of the category associated with each image. Is it possible to return the slug of that category without making multiple calls? Or even something like this:
[ { ...other attributes 'media_category': [ {id: 9, title: 'Test', slug: 'test'}, ] } ]
If that were possible, then I could normalize all of my data as a sort of workaround if the first option isn’t available.
- The topic ‘Retrieve category with its images via REST API’ is closed to new replies.