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 badges
Add a comment  | 

2 Answers 2

Reset to default 2

Actually 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