最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

WP REST API returns empty posts despite entries in wp_posts

programmeradmin0浏览0评论

Using WP API to query posts. There are many entries in wp_posts, but the API always returns an empty array.

Request: /wp-json/wp/v2/posts/

Response: []

Request: /wp-json/wp/v2/posts/3553

Response:

{
    "code": "rest_post_invalid_id",
    "message": "Invalid post ID.",
    "data": {
        "status": 404
    }
}

Yet, querying MySQL directly:

SELECT count(*) FROM wp_posts;

returns 391

SELECT count(*) FROM `wp_posts` where id = 3553;

returns 1

Is there some inherent filtering in the API? I am stumped here.

Thanks Mike

发布评论

评论列表(0)

  1. 暂无评论