简体   繁体   中英

Wordpress “paginate_links” refers to “Not Found” page

I'm trying to make a simple pagination nav menu in WordPress 3.4.2., 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. Is there a way of doing this kind of pagination without external plugins or hacks ?

Tried changing the settings in 'Reading' and 'Permalinks' and still no go..

The error wasn't in Wordpress. I forgot to turn the rewrite module of WAMP.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM