wordpress如何启用REST API

wordpress如何启用REST API

有几种方法汇总一下,请挨个测试。

  1. 访问下边地址,自行替换http://example.com(WordPress 6 用此方法
https://www.yesjh.com/index.php?rest_route=/wp/v2/posts 
https://www.yesjh.com/index.php?rest_route=/wp/v2/posts?page=1

2. 访问下边地址,自行替换http://example.com

http://example.com/index.php/wp-json/wp/v2/posts

3. 访问下边地址,自行替换http://example.com

http://example.com/wp-json/wp/v2/posts

有说是因为文章固定链接的原因,需要改成朴素模式(Plain),也有说要改成文章名模式(Post name),自己试试吧。

留下评论

您的邮箱地址不会被公开。 必填项已用 * 标注