Performance Issue: 504 Timeouts on Parent Category with Deep Hierarchy (Flatsome Theme)
The support doesn work on Saturdays and Sundays, so some Friday requests can be answered on Monday. If you have problems with registration ask help on contact us page pleaseIf you not got email within 24~36 business hours, firstly check your spam box, and if no any email from the support there - back to the forum and read answer here. DO NOT ANSWER ON EMAILS [noreply@pluginus.net] FROM THE FORUM!! Emails are just for your info, all answers should be published only here.
The support doesn work on Saturdays and Sundays, so some Friday requests can be answered on Monday.
Quote from samisraeli on January 29, 2026, 07:17Dear WOOF Support Team,
I am contacting you regarding a severe performance issue on my WooCommerce store. I am using Products Filter Professional for WooCommerce.
The Problem:
I am experiencing extremely slow load times (often resulting in 504 Gateway Timeout errors) specifically on a "Parent Category" page ("Sunglasses").
This category contains approximately 700 products.
It has a deep hierarchy of child categories (e.g., Men, Women, Shapes, Brands, etc.).
The Diagnosis:
I have isolated the issue directly to the WOOF filter.
Comparison: I have another category ("Collection") with a similar number of products (700) but without deep sub-category hierarchy. That page loads instantly with the filter active.
Proof: When I temporarily remove the WOOF widget from the "Sunglasses" sidebar, the page loads instantly. As soon as I re-enable the widget, the page takes 10+ seconds to load or crashes (504).
It seems that the plugin is struggling to process the recursive hierarchy of the parent category, causing a heavy load on the server/database.
Technical Environment:
Theme: Flatsome
- Plugin version: 3.3.7.1
- Wordpress: 6.9
- woocommerce: 9.8.3
Caching Plugin: WP Rocket
Server: VPS Environment
PHP Version: 8.1
Troubleshooting Steps Already Taken:
To attempt to solve this, I have already performed the following actions, but the issue persists during the initial cache build:
WOOF Settings:
Enabled
Cache dynamic recount number-> YesEnabled
Cache terms-> YesEnabled
Hide empty terms-> YesTried
Dynamic Recount-> No (This helped slightly, but we prefer to have it on. Currently set to Yes with caching).Tried
Try to ajaxify the shop-> Checked both Yes and No.Database & Server:
Regenerated WooCommerce Product Lookup Tables.
Regenerated Term Counts.
Cleared all Transients.
Caching (WP Rocket):
Enabled Preload.
Added a delay to the Preload process (0.5s) to reduce server load during cache building.
Confirmed that once a page is successfully cached, it loads fast. However, the initial generation of the page by WOOF is too heavy and often times out before the cache can be created.
My Question:
Is there a specific optimization or index setting for Parent Categories with deep hierarchies? The query seems to be getting stuck when trying to calculate terms for all children and grandchildren of the main category.
I would appreciate your advice on how to optimize the filter for this specific parent category structure.
Thank you,
Sam
Dear WOOF Support Team,
I am contacting you regarding a severe performance issue on my WooCommerce store. I am using Products Filter Professional for WooCommerce.
The Problem:
I am experiencing extremely slow load times (often resulting in 504 Gateway Timeout errors) specifically on a"Parent Category" page ("Sunglasses").
This category contains approximately 700 products.
It has a deep hierarchy of child categories (e.g., Men, Women, Shapes, Brands, etc.).
The Diagnosis:
I have isolated the issue directly to the WOOF filter.
Comparison: I have another category ("Collection") with a similar number of products (700) but without deep sub-category hierarchy. That page loads instantly with the filter active.
Proof: When I temporarily remove the WOOF widget from the"Sunglasses" sidebar, the page loads instantly. As soon as I re-enable the widget, the page takes 10+ seconds to load or crashes (504).
It seems that the plugin is struggling to process the recursive hierarchy of the parent category, causing a heavy load on the server/database.
Technical Environment:
Theme: Flatsome
- Plugin version: 3.3.7.1
- Wordpress: 6.9
- woocommerce: 9.8.3
Caching Plugin: WP Rocket
Server: VPS Environment
PHP Version: 8.1
Troubleshooting Steps Already Taken:
To attempt to solve this, I have already performed the following actions, but the issue persists during the initial cache build:
WOOF Settings:
Enabled
Cache dynamic recount number-> YesEnabled
Cache terms-> YesEnabled
Hide empty terms-> YesTried
Dynamic Recount-> No (This helped slightly, but we prefer to have it on. Currently set to Yes with caching).Tried
Try to ajaxify the shop-> Checked both Yes and No.
Database & Server:
Regenerated WooCommerce Product Lookup Tables.
Regenerated Term Counts.
Cleared all Transients.
Caching (WP Rocket):
Enabled Preload.
Added a delay to the Preload process (0.5s) to reduce server load during cache building.
Confirmed that once a page is successfully cached, it loads fast. However, the initial generation of the page by WOOF is too heavy and often times out before the cache can be created.
My Question:
Is there a specific optimization or index setting for Parent Categories with deep hierarchies? The query seems to be getting stuck when trying to calculate terms for all children and grandchildren of the main category.
I would appreciate your advice on how to optimize the filter for this specific parent category structure.
Thank you,
Sam
Quote from Alex Dovlatov on January 29, 2026, 21:16Hello Sam
Thank you for the detailed report. You've done excellent troubleshooting work, and I can see exactly what's happening here.
The Root Cause:
Your "Sunglasses" parent category has a deep hierarchical structure (Men → Women → Shapes → Brands, etc.). When Dynamic Recount is enabled, WOOF must:
- Recursively process all child categories
- Execute SQL queries for each term to count products
- Calculate counts considering the current category context
With your deep hierarchy, this results in hundreds of database queries on each page load, which is why you're experiencing timeouts.
Why "Collection" works fine:
The "Collection" category has a flat structure (no deep child hierarchy), so WOOF makes far fewer queries - that's why it loads instantly.
About Database Indexes:
Adding a composite index can provide a small performance improvement:
ALTER TABLE wp_term_relationships ADD INDEX idx_woof_perf (term_taxonomy_id, object_id); However, this won't solve the core issue - the sheer number of queries remains the same. The Better Architectural Approach: Here's the key insight: the filter creates heavy load on every page view, but it's not needed 50% of the time - many visitors (including bots and people just browsing) never use the filter at all. My Recommended Solution: Use the filter in hidden/collapsed mode with a button that users click when they actually need it. This way: ✅ The page loads instantly (filter is hidden) ✅ WOOF processes the filter only when the user clicks the button ✅ No performance impact for users who don't filter ✅ Perfect for bots and casual browsers Use this shortcode instead of the widget: [woof start_filtering_btn=1 autohide=1]What this does:
start_filtering_btn=1- Shows a "Start Filtering" buttonautohide=1- Keeps the filter hidden until the button is clicked- The button can be fully customized with CSS to match your Flatsome theme
See it in action here:
https://demo.products-filter.com/hidden-search-form/
How to implement:
- Remove the WOOF widget from the "Sunglasses" sidebar
- Add a Text/HTML widget instead
- Insert the shortcode above
- Customize the button appearance with CSS if needed
This approach gives you the best of both worlds:
- Fast page loads for all visitors
- Full filtering power for those who need it
- Dynamic recount works perfectly (because it only runs when needed)
Let me know if you need help with the button styling or have any questions!
Hello Sam
Thank you for the detailed report. You've done excellent troubleshooting work, and I can see exactly what's happening here.
The Root Cause:
Your"Sunglasses" parent category has a deep hierarchical structure (Men → Women → Shapes → Brands, etc.). When Dynamic Recount is enabled, WOOF must:
- Recursively process all child categories
- Execute SQL queries for each term to count products
- Calculate counts considering the current category context
With your deep hierarchy, this results in hundreds of database queries on each page load, which is why you're experiencing timeouts.
Why"Collection" works fine:
The"Collection" category has a flat structure (no deep child hierarchy), so WOOF makes far fewer queries - that's why it loads instantly.
About Database Indexes:
Adding a composite index can provide a small performance improvement:
ALTER TABLE wp_term_relationships
ADD INDEX idx_woof_perf (term_taxonomy_id, object_id);
However, this won't solve the core issue - the sheer number of queries remains the same.
The Better Architectural Approach:
Here's the key insight: the filter creates heavy load on every page view, but it's not needed 50% of the time - many visitors (including bots and people just browsing) never use the filter at all.
My Recommended Solution:
Use the filter in hidden/collapsed mode with a button that users click when they actually need it. This way:
✅ The page loads instantly (filter is hidden)
✅ WOOF processes the filter only when the user clicks the button
✅ No performance impact for users who don't filter
✅ Perfect for bots and casual browsers
Use this shortcode instead of the widget: [woof start_filtering_btn=1 autohide=1]What this does:
start_filtering_btn=1- Shows a"Start Filtering" buttonautohide=1- Keeps the filter hidden until the button is clicked- The button can be fully customized with CSS to match your Flatsome theme
See it in action here:
https://demo.products-filter.com/hidden-search-form/
How to implement:
- Remove the WOOF widget from the"Sunglasses" sidebar
- Add a Text/HTML widget instead
- Insert the shortcode above
- Customize the button appearance with CSS if needed
This approach gives you the best of both worlds:
- Fast page loads for all visitors
- Full filtering power for those who need it
- Dynamic recount works perfectly (because it only runs when needed)
Let me know if you need help with the button styling or have any questions!
Quote from samisraeli on February 8, 2026, 16:37My filter is displayed as a slideout, not as a shortcode.
Currently, I have set a rule to prevent the slideout from appearing on the sunglasses root category page.
Does this affect your answer?
My filter is displayed as a slideout, not as a shortcode.
Currently, I have set a rule to prevent the slideout from appearing on the sunglasses root category page.
Does this affect your answer?
Quote from Alex Dovlatov on February 9, 2026, 14:20Hello Sam
I understand what you did, but there's an important technical point here:
Your current solution doesn't actually solve the performance problem.
Here's why:
When you "hide" the slideout using display rules or CSS, the WOOF filter has already been processed by the server. All those heavy SQL queries (hundreds of them for your deep category hierarchy) have already been executed. The slideout is just visually hidden - but the server load remains the same.
Think of it like this:
* Server builds the complete filter HTML (does all the heavy work) ✅
* Filter is ready with all data ✅
* CSS/JS just hides it visually ✅
* Result: 504 timeout still happens because the work was already done ❌What would actually help:
The slideout button should exist on the page, but the filter itself should only load when the user clicks the button for the first time. This way:
* Page loads fast (just a button, no queries)
* User clicks slideout button
* ONLY THEN the filter processes and loads
* No wasted server resources for users who don't use filtersBefore we proceed, I need to understand your setup:
1. How exactly are you using the slideout?
* Are you using WOOF's built-in slideout feature?
* Or custom slideout scripts from your Flatsome theme?
* What shortcode/code are you using?2. After hiding the slideout, does the Sunglasses page:
* Load fast now? (under 3 seconds)
* Still timeout/slow? (10+ seconds or 504)3. Can you provide:
* Link to the Sunglasses category page here or in the private area of this tickethttps://share.pluginus.net/image/i20230222134241.png
https://share.pluginus.net/image/i20230222134615.png
https://share.pluginus.net/image/i20230222134511.pngThis information will help me understand if we need a custom solution or if there's a simpler approach.
Hello Sam
I understand what you did, but there's an important technical point here:
Your current solution doesn't actually solve the performance problem.
Here's why:
When you"hide" the slideout using display rules or CSS, the WOOF filter has already been processed by the server. All those heavy SQL queries (hundreds of them for your deep category hierarchy) have already been executed. The slideout is just visually hidden - but the server load remains the same.
Think of it like this:
* Server builds the complete filter HTML (does all the heavy work) ✅
* Filter is ready with all data ✅
* CSS/JS just hides it visually ✅
* Result: 504 timeout still happens because the work was already done ❌
What would actually help:
The slideout button should exist on the page, but the filter itself should only load when the user clicks the button for the first time. This way:
* Page loads fast (just a button, no queries)
* User clicks slideout button
* ONLY THEN the filter processes and loads
* No wasted server resources for users who don't use filters
Before we proceed, I need to understand your setup:
1. How exactly are you using the slideout?
* Are you using WOOF's built-in slideout feature?
* Or custom slideout scripts from your Flatsome theme?
* What shortcode/code are you using?
2. After hiding the slideout, does the Sunglasses page:
* Load fast now? (under 3 seconds)
* Still timeout/slow? (10+ seconds or 504)
3. Can you provide:
* Link to the Sunglasses category page here or in the private area of this ticket
https://share.pluginus.net/image/i20230222134241.png
https://share.pluginus.net/image/i20230222134615.png
https://share.pluginus.net/image/i20230222134511.png
This information will help me understand if we need a custom solution or if there's a simpler approach.
Quote from samisraeli on February 9, 2026, 14:29
- We are using WOOF's built-in slideout feature.
2. After I disabled the slideout from sunglasses archive including all pages it loaded very fast.
- We are using WOOF's built-in slideout feature.
2. After I disabled the slideout from sunglasses archive including all pages it loaded very fast.
Quote from samisraeli on February 9, 2026, 14:33I added the link into the private section.
If I remove the second filter (product categories sunglasses eyeglasses) will it improve the speed?
I added the link into the private section.
If I remove the second filter (product categories sunglasses eyeglasses) will it improve the speed?

Quote from Alex Dovlatov on February 10, 2026, 17:07Hello Sam
Just tried enter your site, but its closed
access denied.
=======================
Client IP:37.15.201.19
Host_Domain:erroca.co.il
Timestamp:2026-02-10T14:51:36.203612022+00:00
Status_Code:491
Request_ID:33b4534816b969c04da22353c31bcd27
Session_ID:b56e6a20ce9b9eda69f633d5604c10ad491bbe0d03fbd7347be9732dI understand your solution, but there's a problem:
The Issue:
If you disable the slideout on the Sunglasses root category - users cannot filter 700 products. They NEED the filter on this page.
If you remove the "Product Categories" filter - yes, it will be faster, but then how will users filter by categories?
Better Solution:
Create a custom slideout that loads the WOOF filter ONLY when the user clicks to open it.
How it works:
- Page loads fast (slideout closed, filter not processed yet) ✅
- User clicks slideout button
- JavaScript automatically triggers the WOOF filter to load
- Filter appears with ALL options including Product Categories ✅
Implementation:
Use this code in your theme's functions.php:
add_action('wp_footer', function () { // Only on product category pages if (!is_product_category()) { //`return; } ?> <!-- Slideout Button --> <div id="woof-slideout-trigger" style="position: fixed; right: 0; top: 50%; transform: translateY(-50%); z-index: 9999; cursor: pointer; background: #333; color: #fff; padding: 15px 10px; border-radius: 5px 0 0 5px; font-weight: bold; writing-mode: vertical-rl; text-orientation: mixed;"> FILTERS </div> <!-- Slideout Panel --> <div id="woof-slideout-panel" style="position: fixed; right: -350px; top: 0; width: 350px; height: 100%; background: #fff; box-shadow: -2px 0 10px rgba(0,0,0,0.3); z-index: 9998; transition: right 0.3s ease; overflow-y: auto; padding: 20px;"> <div style="text-align: right; margin-bottom: 15px;"> <span id="woof-slideout-close" style="cursor: pointer; font-size: 24px; font-weight: bold;">×</span> </div> <!-- WOOF Filter with autohide --> <?php echo do_shortcode('[woof autohide=0 start_filtering_btn=1]'); ?> </div> <!-- Overlay --> <div id="woof-slideout-overlay" style="position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 9997; display: none;"></div> <script> jQuery(document).ready(function ($) { var $trigger = $('#woof-slideout-trigger'); var $panel = $('#woof-slideout-panel'); var $overlay = $('#woof-slideout-overlay'); var $close = $('#woof-slideout-close'); var filterLoaded = false; // Open slideout $trigger.on('click', function () { $panel.css('right', '0'); $overlay.fadeIn(300); // Auto-trigger WOOF "Start Filtering" button on first open if (!filterLoaded) { setTimeout(function () { var $woofBtn = $('.woof_start_filtering_btn'); if ($woofBtn.length) { $woofBtn.trigger('click'); // Hide the button after triggering $woofBtn.hide(); filterLoaded = true; } }, 500); } }); // Close slideout function closeSlideout() { $panel.css('right', '-350px'); $overlay.fadeOut(300); } $close.on('click', closeSlideout); $overlay.on('click', closeSlideout); }); </script> <?php }, 999);
Result:
- Fast page load (no filter processing)
- Full filter functionality when user needs it
- No need to remove any filter options
- Works with your existing WOOF settings
The slideout button styling can be customized to match your theme.
Let me know if you need any adjustments.
Hello Sam
Just tried enter your site, but its closed
access denied.
=======================
Client IP:37.15.201.19
Host_Domain:erroca.co.il
Timestamp:2026-02-10T14:51:36.203612022+00:00
Status_Code:491
Request_ID:33b4534816b969c04da22353c31bcd27
Session_ID:b56e6a20ce9b9eda69f633d5604c10ad491bbe0d03fbd7347be9732d
I understand your solution, but there's a problem:
The Issue:
If you disable the slideout on the Sunglasses root category - users cannot filter 700 products. They NEED the filter on this page.
If you remove the"Product Categories" filter - yes, it will be faster, but then how will users filter by categories?
Better Solution:
Create a custom slideout that loads the WOOF filter ONLY when the user clicks to open it.
How it works:
- Page loads fast (slideout closed, filter not processed yet) ✅
- User clicks slideout button
- JavaScript automatically triggers the WOOF filter to load
- Filter appears with ALL options including Product Categories ✅
Implementation:
Use this code in your theme's functions.php:
add_action('wp_footer', function () {
// Only on product category pages
if (!is_product_category()) {
//`return;
}
?>
<!-- Slideout Button -->
<div id="woof-slideout-trigger" style="position: fixed; right: 0; top: 50%; transform: translateY(-50%); z-index: 9999; cursor: pointer; background: #333; color: #fff; padding: 15px 10px; border-radius: 5px 0 0 5px; font-weight: bold; writing-mode: vertical-rl; text-orientation: mixed;">
FILTERS
</div>
<!-- Slideout Panel -->
<div id="woof-slideout-panel" style="position: fixed; right: -350px; top: 0; width: 350px; height: 100%; background: #fff; box-shadow: -2px 0 10px rgba(0,0,0,0.3); z-index: 9998; transition: right 0.3s ease; overflow-y: auto; padding: 20px;">
<div style="text-align: right; margin-bottom: 15px;">
<span id="woof-slideout-close" style="cursor: pointer; font-size: 24px; font-weight: bold;">×</span>
</div>
<!-- WOOF Filter with autohide -->
<?php echo do_shortcode('[woof autohide=0 start_filtering_btn=1]'); ?>
</div>
<!-- Overlay -->
<div id="woof-slideout-overlay" style="position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 9997; display: none;"></div>
<script>
jQuery(document).ready(function ($) {
var $trigger = $('#woof-slideout-trigger');
var $panel = $('#woof-slideout-panel');
var $overlay = $('#woof-slideout-overlay');
var $close = $('#woof-slideout-close');
var filterLoaded = false;
// Open slideout
$trigger.on('click', function () {
$panel.css('right', '0');
$overlay.fadeIn(300);
// Auto-trigger WOOF"Start Filtering" button on first open
if (!filterLoaded) {
setTimeout(function () {
var $woofBtn = $('.woof_start_filtering_btn');
if ($woofBtn.length) {
$woofBtn.trigger('click');
// Hide the button after triggering
$woofBtn.hide();
filterLoaded = true;
}
}, 500);
}
});
// Close slideout
function closeSlideout() {
$panel.css('right', '-350px');
$overlay.fadeOut(300);
}
$close.on('click', closeSlideout);
$overlay.on('click', closeSlideout);
});
</script>
<?php
}, 999);
Result:
- Fast page load (no filter processing)
- Full filter functionality when user needs it
- No need to remove any filter options
- Works with your existing WOOF settings
The slideout button styling can be customized to match your theme.
Let me know if you need any adjustments.
Quote from samisraeli on February 11, 2026, 08:11It is closed to ip outside my country. I can ask the system admin to enable it.
It is closed to ip outside my country. I can ask the system admin to enable it.
Quote from Alex Dovlatov on February 11, 2026, 13:37Hello Sam
You need it only if you want let me place the script provide above into your site (file functions.php of the current wp theme). You can do it self and it will resolve the question about page loading and filtering
Hello Sam
You need it only if you want let me place the script provide above into your site (file functions.php of the current wp theme). You can do it self and it will resolve the question about page loading and filtering
Quote from samisraeli on February 11, 2026, 16:49I can install the script myself.
You wrote: "Create a custom slideout that loads the WOOF filter ONLY when the user clicks to open it."
Do I need to change any settings in the plugin?
Thank you.
I can install the script myself.
You wrote:"Create a custom slideout that loads the WOOF filter ONLY when the user clicks to open it."
Do I need to change any settings in the plugin?
Thank you.
Quote from Alex Dovlatov on February 12, 2026, 13:58Hello Sam
Insert the code to file functions.php and disable that slideout you used, no another settings need to be changed
Welcome!
Hello Sam
Insert the code to file functions.php and disable that slideout you used, no another settings need to be changed
Welcome!