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:
- Use REGEXP in WP_Query meta_query key
- 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 paginate wordpress [gallery] shortcode?
- 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?
- What kind of object type is WP_Query?
- Changing Posts Per Page and offset with pre_get_posts
- 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
- Ignore a filter on the media library
- 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?
- ‘&’ causes an error in my shortcode when I list the content of the page
- Remove ellipsis from the excerpt retrieved using get_the_excerpt()
- Can certain (site-crashing) limitations on WP_Query in shortcode be overcome?
- Removing posts from the returned wp_query. Cannot use object of type WP_Query as array
- 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?
- Use ‘parse_query’ filter to show posts that from multiple criteria
- How to apply filter inside a single wp_query?
- What is considered a default query for the request filter?
- Using apply_filters(‘the_content’, $custom_query->post_content) alters output
- Modifying the Search Results
- When to add_filter() to Custom Query
- Order by custom table and multiplication
- wp_query add arguments using array_push if variable met
- 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?
- How to get all child pages in their parent page?
- 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?
- Order by title without taking into account ‘the’
- How can I filter by slug depending on language selection
- wp_query ‘s’, search filter with pagination is not working
- Orderby is working with one query but not with other
- 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?
- Filter posts in category archive page by year using a dropdown
- Display filtered results into custom page
- Applying posts_clauses filter to specific queries only
- Add class to first post in custom loop using post_class filter
- WP_Query with different postmeta filter for each categories
- Slow WP_Query with ‘OR’ on meta_query
- Add posts to WP Query object
- 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?
- Redirect to another page using contact form 7? [closed]
- 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
- How to Display Shortcode in the correct location, currently displaying before content after Page Title?
- Using post_where filter only on main query NOT sidebard new WP_Query
- Filtering posts by archive showing all years
- WP_query only displays one of my custom post type entries
- WP_Query – How to get all posts of specific days of week by custom field date?
- Assign a minimum result count for WooCommerce query shortcodes?
- Multiple wp_query on archive page
- Retrieve select tag custom values from array and display them in current page with wp_query?
- How to use a dropdown to filter posts by custom field
- Using a Shortcode to List Posts from Multiple Categories
- Woocommerce set loop_shop_columns to be 3 in the main shop page loop only and 4 otherwise
- List categories using WP_Query
- I need to get all categories from a WP_Query
- WP_query shortcode inside acf Repeater breaks the repeater loop
- 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)
- filter the custom post type using wp ajax request
- WP_Query filtering in ACF field containing dates
- Products are displayed only in the admin area
- Grab IDs of products from WP_Query which is run elsewhere
- How to create a three column blog layout with a single query and with three different classes?