0

I've an issue with the pagination function in WordPress.

Although the anchor text is correct, when I hit the URL for some reasons WP changes it from

www.site.com/page?page=2 to www.site.com/page/2 thus generating a 404 error.

My pagination call is like the following:

 $paginate_links = paginate_links( array(
                    'base' => preg_replace('/\?.*/', '/', get_pagenum_link()) . '%_%',
                    'prev_text' => __('«'),
                    'next_text' => __('»'),
                    'mid_size'  => 5,
                    'current'   => $current,
                    'total'     => $totalpages
                ));

The strange thing is that using the same function in an archive page I get this working properly. Any idea on what is wrong?

0

You have the pretty urls turned on?

What happens if you add the format parameter to paginate_links?

'format'       => '?page=%#%',

Full reference here http://codex.wordpress.org/Function_Reference/paginate_links

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.