1

Possible Duplicate:
paginate_links() don’t properly work in search.php?

I'm trying to make a simple pagination nav menu, using the following code:

global $wp_query;
                    $total_pages = $wp_query->max_num_pages;

                    if($total_pages > 1) {

                        $current_page = max(1, get_query_var('paged'));

                        echo paginate_links(array(
                            'base'  =>  get_pagenum_link(1).'%_%',
                            'format'    =>  'page/%#%',
                            'current'   =>  $current_page,
                            'total'     =>  $total_pages,
                            'prev_next' =>  false,
                            'type'      =>  'list'

                        ));
                    }

But when I click on a page link it's reffering me to:

Not Found

The requested URL /wptest/page/2 was not found on this server.

I know that it's probably something simple that I missed but I don't know what is it.

  • Yes, I just spent additional hour reading the already asked questions and there isn't a simple answer to this one. Most of them are hacks and additional functions and I just want to use the built in paginate_links function. I supposed that there will be a new official and simple way of doing the pagination thingie.. – Ziik Oct 31 '12 at 12:59
  • This is very hard to answer without more details. Where are you placing the code? For example if you are trying to add pagination to a custom post type it requires some extra "hacks" to support that. The base and format arguments should be fixed though, that's for sure.... Here is an example of the code I would use if you want to test it out: gist.github.com/wpexplorer/6a42aadeb87934d31a4172983077d01e – WPExplorer Jul 24 '17 at 19:06