Limited Time Sale - 10% Discount! Use Code:U5ZBQTEY

Custom Filters


This document explains how to increase/decrease the limit on queried posts related to the Hide Empty Filters toggle in Divi FilterGrid’s Taxonomy Filters section and the Auto Fetch Dates toggle in the Date Filters section.

The Hide Empty Filters and Auto Fetch Dates features both inspect the module’s base query results to decide which filter options should be displayed:

  • Hide Empty Filters checks which taxonomy terms are assigned to posts in the module’s base query.
  • Auto Fetch Dates checks which years and months exist in the module’s base query.

To prevent expensive queries on large sites, Divi FilterGrid limits this availability scan to 2,500 matching posts by default. If the module’s base query exceeds that limit, the feature will fail gracefully:

  • Hide Empty Filters will show the normal configured filter terms.
  • Auto Fetch Dates will fall back to the manually entered or default years/months.

The 2,500 limit is considered a “safe” number of posts to query and should succeed on most sites that likely have far fewer posts. For larger sites, this limit can be increased with the dpdfg_availability_query_max_posts filter.

* Caution should be used when increasing this limit, especially on shared hosting plans. Even on VPS hosting plans, large queries can slow down your site and even trigger action by your host who may block this request. It is HIGHLY recommended that you install a caching plugin on your site when using these features – otherwise the query will run on every page load where the Divi FilterGrid module is loaded with either of these toggles turned on. Even a simple caching plugin like WP Super Cache will cache this large query and prevent it from running every time the page is loaded.

Increase the Limit

There are several examples below. To increase the limit for both features for the entire site, simply add lines 13-15 to your child theme’s functions.php file or using a plugin like Code Snippets:

Pin It on Pinterest

Share This