paginate_links() adds empty href to first page and previous link

Have you tried specifying the base and format arguments for paginate_links()? It assumes the default values of:

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

Your base should be something like /parent-page/child-page/%_%; then the first page link will be to /parent-page/child-page/, and subsequent links will follow the format /parent-page/child-page/?page=3 (example for page 3).

In the base, the %_% is replaced by the format argument.
In the format, the %#% is replaced by the page number.

http://codex.wordpress.org/Function_Reference/paginate_links

Leave a Comment