So i’m trying to use $_GET Variables with permalinks to let the user change sort order of posts.
It works fine until i try to use pagination.
So i have this function which change rewrite rule to match my custom post type “revendeurs” and add the sort value to my permalink.
So the url looks like this for example : http://mysite.com/revendeurs/city
Meaning, it shows “revendeurs” posts sorted by “city” parameter.
Works fine for the first page then the second page link of WP-PageNavi is : http://mysite.com/revendeurs/city/page/2
and it fails to show the results.
I guess i need to update add_rewrite_rules() (see function below) when pagination is used but i don’t how to detect when there is the page parameter.