HUSKY - Products Filter Professional for WooCommerce

Avada 分页可能出现的问题

Sometimes using HUSKY Filter with the Avada theme, filters are lost when navigating to page 2 or any subsequent pagination pages. The filtering works correctly on page 1, but breaks completely when clicking pagination links like /page/2/.

症状:

  • 筛选器在第 1 页上工作: https://example.com/shop/fltr/product_cat-category/
  • 第 2 页过滤器丢失: https://example.com/shop/fltr/product_cat-category/page/2/
  • 显示所有产品而不是过滤结果

根本原因

该问题是由 Avada 的 shop_template_loader() method in the Avada_Woocommerce 类,用于在使用了自定义商店页面模板时修改 WordPress 查询对象。

有问题代码位置: /wp-content/themes/Avada/includes/class-avada-woocommerce.php

要解决此问题,请将以下代码添加到您当前的 WordPress 主题的 functions.php 文件中:

add_action('template_redirect', function() {
    global $wp_query;
	
    // If WOOF is filtering
    if (is_woof_search_going()) {
        $wp_query->is_search = true;
    }
    
}, 1); // Priority 1 - VERY early, before everything

Source: https://pluginus.net/support/topic/pagination-showing-incorrect-page-count-and-404-errors-with-avada-husky-filter/?part=2