WP-API身份验证问题

时间:2015-05-09 15:55:41

标签: wordpress wp-api

我有一个wordpress页面,我正在尝试使用WP AJAX REST API创建帖子。我的期望是,如果用户已经登录,则auth cookie将会到位并且我将能够使用用户的上下文进行AJAX POST。然而,我收到的用户未获得授权的错误。我错过了什么?感谢

1 个答案:

答案 0 :(得分:0)

此插件未保持更新,但添加新帖子的工作原理如下:

  1. <link rel="stylesheet" href="http://code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css"> 并激活帖子控制器

  2. 获取现时

    Go to the settings -> json api

  3. 从响应中抓取现时,响应应为:

    http://www.example.com/?json=core.get_nonce&controller=posts&method=create_post&callback=?

  4. 4.发表帖子

    ?({"status":"ok","controller":"posts","method":"create_post","nonce":"38nonce84"})
相关问题