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.
Related Posts:
- How to list some posts first in the loop based on post id
- Whats the difference between post_limits and pre_get_posts?
- How to add taxonomy filter on the query fly?
- WP_Query – filter or directly?
- What is the most efficient way of querying posts based on visits and date for current day?
- ajax category filter
- How to order posts tag by tag?
- Overriding The Loop with filter or hook
- Custom query incorrectly returning everything [closed]
- Last post ordered by publish date using WP_Query on front page
- WP Rest API v2 return posts with specific tag
- How to filter sql only for a specific post type
- How to support multiple search terms query within one process?
- Shortcode returns escaped HTML tags
- WP_Query in a shortcode
- How to get any tag ID
- Which filter/action hook gets triggered after a query has been performed?
- Can certain (site-crashing) limitations on WP_Query in shortcode be overcome?
- How to implement time filter to show random post 1 month for one category and 3 months for other categories
- What’s the point of the query_vars filter?
- Refine/Filter WP_Query Posts with jQuery or Ajax
- How to retrieve current page WP_Query arguments?
- How to apply filter inside a single wp_query?
- When to add_filter() to Custom Query
- Order by custom table and multiplication
- Query total number of posts
- Category attribute not working in custom shortcode
- How to add post_distinct filter to WP_Comment_Query?
- Using Ajax to load more posts | Help me change the wording on my button to notify the user
- How to use filter hook “the_posts” with a function that refers to $this?
- How to create a WordPress Post Filter that users can use to filter posts by year?
- Database Queries Optimization with new WP_Query
- add_filter() depending on search term
- query_vars filter not working even though query string parameter is present
- How do I run through a WordPress loop called from a filter function?
- How can I filter by slug depending on language selection
- wp_query ‘s’, search filter with pagination is not working
- How to filter, restrict and return posts based on custom user meta information
- Bypass “supress_filters” in WP Query
- How to use the query hook/filter?
- Display filtered results into custom page
- Applying posts_clauses filter to specific queries only
- WP_Query with different postmeta filter for each categories
- Slow WP_Query with ‘OR’ on meta_query
- Shortcode for latest -not expired- posts
- Gallery shortcode numerical sorting
- How to alter local query, not main query [duplicate]
- How can I allow sticky posts but cap the query to 1 post?
- how to access query string in wordpress?
- How should I approach changing the template & $query as part of a shortcode’s execution?
- Filter Custom Taxonomy Posts
- Include posts from some categories while excluding from others
- Changing the default wp_search_stopwords
- Filter post query to only show direct children of category
- Is it possible to add an argument to a custom function added to a filter hook?
- How to make posts unqueryable/unpublish posts where ACF relationship field is an unpublished post? [closed]
- Shortcode Not Working in Slider When Added To Post Title
- Shortcode for custom query not returning results when attributes are added
- Change AJAX filter from POST to GET for URL Parameters
- Using post_where filter only on main query NOT sidebard new WP_Query
- Using a Shortcode to List Posts from Multiple Categories
- Remove post type filter added by the plugin in the final query
- embedding shortcodes in php template
- relation OR instead of AND – Filtered term ID’s in loop
- Can’t order the query result as given posts id’s array
- How to get specific string in explode array?
- filter posts by meta key with pagination
- Why does apply_filters behave different inside and outside a loop?
- meta_query weird behaviour, static int will work, but not user data
- Filter sub-category from checkbox form
- Woocommerce Shortcode which displays a table with product data
- My combination of ‘post_type’ and ‘tax_query’ not working?
- How to add a “base” filter for all posts visible to visitors on the site?
- WP Query by 4 different taxonomies
- WordPress – Form does not filter the results of taxonomies
- How to display a post(by id) along with css in a page?
- Custom category page with taxonomy filters
- pages shortcode filtering by category
- get term objects and post objects in query
- How to set selected attribute on option after filter query?
- Issue generating custom filter for cpt admin columns
- Query by Category and Custom Field – Shortcode
- How to take parameters from a function and make them editable as attributes in a shortcode
- How to modify WP Query to target the first most recent post to adjust content
- Object of class WP_Query could not be converted to int inside shortcode
- Custom query with post_class filter using current_post not working
- Get Current CPT taxonomy category in shortcode
- Add filter to Orderby Parameter using Array
- More efficient query to display posts in same sub-category?
- Having Trouble Running Query From Shortcode Using Tribe’s Events Plugin
- Filter WP_Query output before it is accessed (pre_get_posts)?
- Loop the posts between two dates selected using jquery datepicker
- query post based on comparison
- How to write a query-function as a query-shortcode?
- shortcode with $atts with strange results
- Edit WordPress loop, taxonomies, & filter
- Woocommerce set loop_shop_columns to be 3 in the main shop page loop only and 4 otherwise
- I need to get all categories from a WP_Query
- How to prevent WP query searching in executed shortcodes
- WP_Query filter Posts by timestamp event (range start and end) and by month (next 12 month)