 <pre><code>function paging_nav() { $paged = get_query_var( 'paged' ) ? intval( get_query_var( 'paged' ) ) : 1; $pagenum_link = html_entity_decode( get_pagenum_link() ); $query_args = array(); $url_parts = explode( '?', $pagenum_link ); if ( isset( $url_parts[1] ) ) { wp_parse_str( $url_parts[1], $query_args ); } $pagenum_link = remove_query_arg( array_keys( $query_args ), $pagenum_link ); $pagenum_link = trailingslashit( $pagenum_link ) . '%_%'; $format = $GLOBALS['wp_rewrite']-&gt;using_index_permalinks() &amp;&amp; ! strpos( $pagenum_link, 'index.php' ) ? 'index.php/' : ''; $format .= $GLOBALS['wp_rewrite']-&gt;using_permalinks() ? user_trailingslashit( 'page/%#%', 'paged' ) : '?paged=%#%'; $links = paginate_links( array( 'base' =&gt; $pagenum_link, 'format' =&gt; $format, 'total' =&gt; $GLOBALS['wp_query']-&gt;max_num_pages, 'current' =&gt; $paged, 'mid_size' =&gt; 1, 'add_args' =&gt; array_map( 'urlencode', $query_args ), 'prev_text' =&gt; __( 'Previous Page ' ), 'next_text' =&gt; __( 'Next Page' ), ) ); echo $links ; </code></pre>