This commit is contained in:
2025-07-18 16:11:37 -07:00
parent 3364ea642b
commit a4730a4eec

View File

@@ -25,6 +25,16 @@ class DontShowProductsOnShopLandingPageAction extends RadAction
return; return;
} }
// Remove everything hooked to the product loop
remove_all_actions('woocommerce_before_shop_loop');
remove_all_actions('woocommerce_shop_loop');
remove_all_actions('woocommerce_after_shop_loop');
// Also prevent product loop rendering itself
remove_all_actions('woocommerce_before_main_content');
remove_all_actions('woocommerce_after_main_content');
remove_all_actions('woocommerce_no_products_found');
add_action('pre_get_posts', function ($query) { add_action('pre_get_posts', function ($query) {
if (!is_admin() && $query->is_main_query()) { if (!is_admin() && $query->is_main_query()) {
$query->set('post_type', 'product'); $query->set('post_type', 'product');