用于wordpress的JSON API插件没有返回正确的东西


JSON API Plugin for wordpress not returning the right things

我用静态html为我的网站创建了一个移动应用程序,现在我想使用ajax从我的wordpress原始网站获取我的帖子、页面、标题、图像等。

为此,我认为最好的解决方案是使用JSON API插件->https://wordpress.org/plugins/json-api/

我已经安装了,它在页面上运行良好,除了主页,它没有为我的移动应用程序发送正确的想法。

有人知道问题出在哪里吗?这是我的wordpress网站的问题,或者可能是插件的问题?

它发送的是:

{
  "status": "ok",
  "count": 1,
  "count_total": 1,
  "pages": 1,
  "posts": [
    {
      "id": 1689,
      "type": "post",
      "slug": "teste",
      "url": "http://myurlsite.com/teste/",
      "status": "publish",
      "title": "Teste",
      "title_plain": "Teste",
      "content": "<p>[123-contact-form i523156]</p>'n",
      "excerpt": "<p>[123-contact-form i523156]</p>'n",
      "date": "2013-12-10 20:11:14",
      "modified": "2013-12-10 20:11:14",
      "categories": [
        {
          "id": 1,
          "slug": "sem-categoria",
          "title": "Sem categoria",
          "description": "",
          "parent": 0,
          "post_count": 1
        }
      ],
      "tags": [],
      "author": {
        "id": 1,
        "slug": "admin",
        "name": "admin",
        "first_name": "Administrador",
        "last_name": "Wemaster",
        "nickname": "admin",
        "url": "",
        "description": ""
      },
      "comments": [],
      "attachments": [],
      "comment_count": 0,
      "comment_status": "open",
      "custom_fields": {
        "cro_sidebar": [
          "1"
        ],
        "cro_sidebarsel": [
          "0"
        ],
        "cro_readmore": [
          "1"
        ],
        "cro_showpromo": [
          "1"
        ]
      }
    }
  ]
}

如果你观察到,它返回的是一个帖子,而不是一个页面:

 "type": "post",
 "slug": "teste",
  "url": "http://myurlsite.com/teste/",
  "status": "publish",
  "title": "Teste",
  "title_plain": "Teste",

我删除了测试帖子,现在它返回这个:

{"status":"ok","count":0,"count_total":0,"pages":0,"posts":[]}

尝试通过以下网址访问帖子:

http://www.yourdomain.com/api/get_page/?slug=<page-slug>

或者使用页面id:

http://www.yourdomain.com/api/get_page/?id=<page-id>

我已经测试了两者,并且两者都使用该插件。

有关详细信息,请阅读开发人员提供的此信息。