Could this be the cause?
I was checking how the get_pagenum_link() function works and I found this:
$request = remove_query_arg( ‘paged’ );
So, apparently it is supposed to remove the “?page=” argument of the current page – before replacing it with the one we passed as a parameter.
However, it seems that since WordPress 3.0.2 the correct query var would be ‘page’ and not ‘paged’.
However, it seems that since WordPress 3.0.2 the correct query var would be ‘page’ and not ‘paged’.
Both query vars are used differenty on theme template files. I don’t know if this changed recently and if the information in the codex is (still) correct.
The “page” query var is used on a paginated single post or page template file (single.php, page.php, custom Page template files). It’s also used for pagination on a static front page (page template).
The “paged” query var is used on a paginated archive template file (index.php, category.php, search.php, etc).
On what template file do you get these results?
@keesiemeijer thank you for the clarification. It completely solved my problem.
What happened was that I was using the paginate_links() function in the index.php and category.php templates to create pagination links.
The problem is that this function uses the “page” query var by default to create the links. That’s why it was adding “?page=” to all the links. Which (now) makes sense if you are using it to create pagination links in a single post or page template.
However, if you want to use this function to create pagination links for the index.php or category.php templates, you need to pass something like “?paged=%#%” as the “format” parameter to make it use the “paged” query var instead.
Just like in the example at the bottom of this page:
http://codex.wordpress.org/Function_Reference/paginate_links
I wish that page did a better job at explaining why and when you need to pass this parameter. But your explanation totally helped me understand it.
Thanks again.
OK, so it turns out you don’t even need to pass the “format” parameter to the paginate_links() function as long as you use “%#%” in the “base” parameter.
“%#%” will be replaced by the page number. However if you use “%_%” in the base parameter, you do need to pass the “format” parameter or it will use the default “?page=%#%”.
So if you are using paginate_links() to create links on the index.php or category.php templates the easiest solution is to pass the “base” parameter as in this example: http://codex.wordpress.org/Function_Reference/paginate_links#Examples
then you can skip the “format” parameter if you want to.