我是WordPress的新手。我已经安装了WordPress和插件wp-json-api用户。
我使用以下API获取用户nonce:
http://localhost/wordpress/?json=get_nonce&控制器=用户&method=注册
然后我使用以下请求创建了一个新用户:
http://localhost/wordpress/api/user/register/?username=john&电子邮件=john@domain.com&nonce=89a3935cdc&display_name=John
我的回复是404。
I modified the nginx conf as below :
1) I added the try_files
location /wordpress/ {
index index.php index.html index.htm;
try_files $uri $uri/ /wordpress/index.php?$args;
}
location ~.php {
include /usr/local/etc/nginx/fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
2) Added the perma links in the wordpress : Custom perma links
/api/
Now it works fine.
确保您已从wordpress管理面板中选中"任何人都可以注册"。然后转到设置>Json Api,底部有一个应该用于Json Api请求的示例链接,您可能已经重新定义了Api值,但您没有在请求中传递正确的当前Api值。