How to filter a static post page with ajax and $wp_query
The original request that loaded the page you are making the AJAX request from ended as soon as the page was sent to your browser. That connection is closed and it is gone from memory. When you make an AJAX request, it’s a new request, so $wp_query is empty because you haven’t queried anything. You … Read more