admin管理员组文章数量:1336632
Ok, so I am using WordPress rest API to fetch the data using front-end. I am having the plain permalinks and unfortunately, I am not allowed to change the permalinks. So, for
I am using the route option:
/?rest_route=/wp/v2/posts
And this is working completely fine.
Now my question is if I want to access a page URL with query params :
How could I do that with rest_route? Thanks in advance.
Ok, so I am using WordPress rest API to fetch the data using front-end. I am having the plain permalinks and unfortunately, I am not allowed to change the permalinks. So, for
https://www.example
I am using the route option:
https://www.example/?rest_route=/wp/v2/posts
And this is working completely fine.
Now my question is if I want to access a page URL with query params :
https://www.example?cat=12
How could I do that with rest_route? Thanks in advance.
Share Improve this question edited May 21, 2020 at 12:00 new asked May 21, 2020 at 11:34 newnew 314 bronze badges2 Answers
Reset to default 2Actually I was able to figure out with a little modification to Rank's answer:
https://www.example/?rest_route=/wp/v2/posts&categories=12
You have to add the parameters at the end, so it is defined which data should be affected. You add it after the 'post' to get all posts within the category with the id of 12.
https://www.example/wp-json/wp/v2/posts?categories=12
本文标签: permalinkswordpress api using restroute for other pages
版权声明:本文标题:permalinks - wordpress api using rest_route for other pages 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742412509a2470068.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论