简体   繁体   English

WP REST API V2 wp / v2 /媒体问题

[英]WP REST API V2 wp/v2/media problems

I am working on an android app for practice, that for now gets all the posts and their featured images and displays them in a listview. 我正在开发一个Android应用程序进行练习,目前可以获取所有帖子及其特色图片,并在列表视图中显示它们。 The problem is, and this started happening a few posts ago, I create a new post, set a featured image and publish it. 问题是,这开始发生在一些帖子之前,我创建了一个新帖子,设置了特色图片并发布了。 It appears in wp/v2/posts, but the featured image doesn't appear in wp/v2/media. 它出现在wp / v2 / posts中,但特色图像没有出现在wp / v2 / media中。 Under _links/wp:featuredmedia there is a link to the image in wp/v2/media, but when I press it, it says rest_forbidden. 在_links / wp:featuredmedia下,有一个指向wp / v2 / media中图像的链接,但是当我按下它时,它显示rest_forbidden。 And now my app can't access the featured images of the posts. 现在,我的应用无法访问帖子的精选图片。

Your featured image must be related to a published post (or you'll need to tweak the media post_status in the database). 您的特色图片必须与已发布的帖子相关(否则,您需要调整数据库中的媒体post_status)。 More informations about this here : https://github.com/WP-API/WP-API/issues/2596 有关此的更多信息: https : //github.com/WP-API/WP-API/issues/2596

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM