diff --git a/includes/abstracts/abstract-wc-widget.php b/includes/abstracts/abstract-wc-widget.php index 67bc1dfc351..8ca7b05d162 100644 --- a/includes/abstracts/abstract-wc-widget.php +++ b/includes/abstracts/abstract-wc-widget.php @@ -347,6 +347,11 @@ abstract class WC_Widget extends WP_Widget { // Post Type Arg. if ( isset( $_GET['post_type'] ) ) { $link = add_query_arg( 'post_type', wc_clean( wp_unslash( $_GET['post_type'] ) ), $link ); + + // Prevent post type and page id when pretty permalinks are disabled. + if ( is_shop() ) { + $link = remove_query_arg( 'page_id', $link ); + } } // Min Rating Arg. diff --git a/includes/widgets/class-wc-widget-price-filter.php b/includes/widgets/class-wc-widget-price-filter.php index 0949c7518dc..6014dad2890 100644 --- a/includes/widgets/class-wc-widget-price-filter.php +++ b/includes/widgets/class-wc-widget-price-filter.php @@ -106,7 +106,7 @@ class WC_Widget_Price_Filter extends WC_Widget {
- ' . wc_query_string_form_fields( null, array( 'min_price', 'max_price' ), '', true ) . ' + ' . wc_query_string_form_fields( null, array( 'min_price', 'max_price', 'paged' ), '', true ) . ' diff --git a/includes/widgets/class-wc-widget-rating-filter.php b/includes/widgets/class-wc-widget-rating-filter.php index 3a64f15e404..f4974dacc8a 100644 --- a/includes/widgets/class-wc-widget-rating-filter.php +++ b/includes/widgets/class-wc-widget-rating-filter.php @@ -110,7 +110,7 @@ class WC_Widget_Rating_Filter extends WC_Widget { continue; } $found = true; - $link = $this->get_current_page_url(); + $link = remove_query_arg( 'paged', $this->get_current_page_url() ); if ( in_array( $rating, $rating_filter, true ) ) { $link_ratings = implode( ',', array_diff( $rating_filter, array( $rating ) ) ); @@ -119,7 +119,7 @@ class WC_Widget_Rating_Filter extends WC_Widget { } $class = in_array( $rating, $rating_filter, true ) ? 'wc-layered-nav-rating chosen' : 'wc-layered-nav-rating'; - $link = apply_filters( 'woocommerce_rating_filter_link', $link_ratings ? add_query_arg( 'rating_filter', $link_ratings ) : remove_query_arg( 'rating_filter' ) ); + $link = apply_filters( 'woocommerce_rating_filter_link', $link_ratings ? add_query_arg( 'rating_filter', $link_ratings, $link ) : remove_query_arg( 'rating_filter' ) ); $rating_html = wc_get_star_rating_html( $rating ); $count_html = wp_kses( apply_filters( 'woocommerce_rating_filter_count', "({$count})", $count, $rating ),