Not all featured image sizes available in Rest API

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

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?

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745501027a4630416.html

相关推荐

  • Not all featured image sizes available in Rest API

    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

    3小时前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信