1

I'm using Vue.js to consume the Rest API for both posts and a custom post type. I'm using the _embed query on the URL for the endpoint to get sizes for the each featured image.

The issue that I'm encountering is that the "full" size is present on most featured images, but not all. As an experiment, I've also registered a custom image size, which also shows on most posts but not all. I've regenerated media via WP CLI, but no success.

This is troublesome because it causes unpredictability in the Vue app if the size isn't present for a particular post (and, yes, I know I should write the logic to fail gracefully for that, but it feels like this should be a safe bet that each image would have the "out of the box" featured image sizes).

When calling my endpoint into Postman, I can see that _embedded['wp:featuredmedia'][0].media_details.sizes varies for each item. Only some have "large," some have "medium_large", etc. I've used wp media regenerate, which returns success, but still doesn't resolve.

So my question is, how do I ensure that all items of this post type have the same featured image sizes available?

  • Hm, without seeing the actual code and the commands you used, and without knowing more context, hard to tell what's going on. Please dump your code, commands and the response you currently get, and let us know what response exactly you are expecting to get. Many thanks – leymannx May 12 at 9:48
  • Edited the question with more detail. – DavidBrown May 12 at 13:03
  • It seems more related to the plugins or themes registering their thumbnails that an issue with the REST API itself. I´m not certain of this but could be that according to certain query conditions (for example) some sizes could be generated. You could try registering a custom field for the image on your own. – Jesús Franco May 17 at 16:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.