For example i’ve domain.com/about?project=1
but i’ve permalinks enabled and i’m using thins to generate the pagination paginate_links. The proble is that the links generated are like this domain.com/about?project=1/page/1
and it breaks everything because the project is taken as 1/page/1
There is a way to get domain.com/about/project/1/page/1
in the paginations links? I’m submitting that from a form using get to display the project.
To add arguments to the links in paginate posts, use the
'add_args'
argument in the function. You have to pass the arguments as an associative array. So, to addproject=1
to the end of all your links, you would do this:Hope that helped!
EDIT
To get
domain.com/about/projects/1/page/1
, you can add a custom permastruct. I’m going to assumeabout
is a page.After adding that code, flush the rewrite rules by going to Settings -> Permalinks.