Fix pagination by preventing old query args from being re-added to the link

Fixes #7164
This commit is contained in:
Mike Jolley 2015-01-20 09:43:53 +00:00
parent 0b393b7e82
commit 7f2a6b5e41
2 changed files with 6 additions and 3 deletions

View File

@ -104,12 +104,14 @@ if ( ! defined( 'ABSPATH' ) ) {
<div class="pagination">
<?php
echo str_replace( 'page-numbers', 'page-numbers button', paginate_links( array(
'base' => add_query_arg( 'p', '%#%' ),
'base' => esc_url_raw( add_query_arg( 'p', '%#%', remove_query_arg( 'p' ) ) ),
'format' => '',
'add_args' => '',
'type' => 'plain',
'prev_text' => '&laquo;',
'next_text' => '&raquo;',
'total' => ceil( absint( $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(tax_rate_id) FROM {$wpdb->prefix}woocommerce_tax_rates WHERE tax_rate_class = %s;", sanitize_title( $current_class ) ) ) ) / $limit ),
'current' => $page
'current' => $page,
'total' => ceil( absint( $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(tax_rate_id) FROM {$wpdb->prefix}woocommerce_tax_rates WHERE tax_rate_class = %s;", sanitize_title( $current_class ) ) ) ) / $limit )
) ) );
?>
</div>

View File

@ -22,6 +22,7 @@ if ( $wp_query->max_num_pages <= 1 ) {
echo paginate_links( apply_filters( 'woocommerce_pagination_args', array(
'base' => esc_url_raw( str_replace( 999999999, '%#%', remove_query_arg( 'add-to-cart', get_pagenum_link( 999999999, false ) ) ) ),
'format' => '',
'add_args' => '',
'current' => max( 1, get_query_var( 'paged' ) ),
'total' => $wp_query->max_num_pages,
'prev_text' => '&larr;',