add_action('wp_ajax_filter_black_beauty_products', 'filter_black_beauty_products_debug'); add_action('wp_ajax_nopriv_filter_black_beauty_products', 'filter_black_beauty_products_debug'); function filter_black_beauty_products_debug() { $filter = sanitize_text_field($_POST['filter']); // Log the incoming filter error_log('AJAX Filter Triggered: ' . $filter); $args = array( 'post_type' => 'product', 'posts_per_page' => 4, // You can increase this to show more ); // Log the query arguments for verification error_log('Query Args: ' . print_r($args, true)); $loop = new WP_Query($args); if ($loop->have_posts()) { echo '
No products found for this filter.
'; } wp_reset_postdata(); wp_die(); }