How to filter a query by date in a shortcode?

Note that you’re returning from the shortcode’s callback with:

return $pops_content;

before removing the filter’s callback with:

remove_filter('posts_where', 'filter_where'); 

So it’s never called.

That means you’re affecting all the later WP_Query instances with your filter.

Note that you can use date_query in WP_Query instead, so you don’t need the posts_where filtering.

error code: 523