You’ve got trailing space in your $query->set()
.
Instead of
$query->set( 'date_query ', ...
it should be:
$query->set( 'date_query', ...
Related Posts:
- Date Query to Pull Current and Future Posts
- Sticky Posts exceed posts per page limit
- Theres a way to use $query->set(‘tax_query’ in pre_get_posts filter?
- Modify Taxonomy pages to exclude items in child taxonomies
- Obliterate the main query and replace it
- Post injection – how to exclude the original post
- Adding meta_key via pre_get_posts causes navigation to disappear
- Sorting posts that has a meta value first then the rest of the posts
- pre_get_posts on a page
- How pre_get_posts filter by roles in WP Admin
- Weird problem with pre_get_posts and $query->is_page()
- Why is ‘pre_get_posts’ having no effect?
- pre_get_posts all posts and custom post type with certain tag
- Using Sessions to Filter Posts – bad thing?
- pre_get_posts and the blog page
- Archive by custom post type and custom date field
- pre_get_post filter returns results when there should not be
- Trying to exclude first 5 posts from the first page on the homepage
- Exclude a WordPress post from pre_get_posts if a field is null
- Only show certain post types in recent posts widget
- pre_get_posts for exclude category
- pre_get_posts: using tax_query only for certain post type
- pre_get_posts dont firing… Anybody knows whats the wrong with my code?
- Restrict Search Query To After Specific Date
- WP_Error not displaying errors
- Show all posts even if URL points to a single one
- How to achieve post_status__not_in?
- Ordering by meta_key
- Using a pre_get_posts filter to search for multiple strings on all meta values
- Removing taxonomy query by pre_get_posts
- Using different parameters for different queries with pre get posts in functions.php
- how to restrict posts_request filter to the main query only
- Automatically applying a pre_get_posts filter for child categories only
- How to override a query and display specific page by ID?
- pre_get_posts variables
- Another query in pre_get_post cause memory issue
- pre_get_posts having no effect on my category archive
- pre_get_posts returns non property object when using posts__not_in
- Override tax_query with pre_get_posts to include other term_ids on a single category
- date_query in pre_get_posts out of memory
- $query->is_main_query() is causing query’s tax_query to be ignored
- Menu disappears when meta_key changed [closed]
- pre_get_posts with multiple queries
- How to show the last and newest modified post in a custom category?
- Altering the main query using get_post_meta() in pre_get_posts
- Why query by specific date with variables doesn’t return same result that with harcoded integers?
- Sort WordPress Archive by multiple oderby arguments in pre_get_posts action
- Exclude post type with pre_get_posts?
- Exclude page by title for non admins
- problem with setting tax_query in pre_get_posts
- Problem ID to exclude specific posts from category
- Modify Taxonomy pages to exclude items in child taxonomies
- Modify author archive query to combine two queries
- Change post order on archive to be displayed by most commented being ignored by theme
- Complex query using pre_get_posts
- Super confusing ‘pre_get_posts’ behavior with $query->set
- Having trouble with settings terms as array in pre_get_posts
- Override main query for page template
- Querying custom taxonomy on category-specific page is overwritten by function
- how to get content from other site and show it?
- Insert a variable in pre_get_posts
- Extend taxonomy term page with other posts
- Set a custom number of posts on the first page
- Why does this query not SELECT post IDs like a normal query would?
- Please ensure me that I’m not crazy using the pre_get_posts [closed]
- How to pass >= condition filter to my year custom tax_query
- What is the proper way to use pre_get_post?
- pre_get_posts has php notice when not on CPT archive
- Duplicating event posts in wordpress
- Media library to list images only user uploaded
- Using meta_query on pre_get_posts to exclude a particular meta_key value
- Changing the meta_query of the main query based on custom query_vars and using pre_get_posts
- Single page theme that uses pages for the content
- is_category in pre_get_posts results in php notices
- Using pre_get_posts on a specific core/query block
- Using pre_get_posts to filter out posts, pagination problem
- Get posts for last working week in WP_Query
- Force is_search to always TRUE
- Display posts from only one post form in custom query and exclude in main query
- How to use $query->set with post__in?
- Blog page pagination is not working after using the offset argument
- Get .subsubsub count of post per status queried using pre_get_posts
- Make blog page show 10 on first page, 9 on every other page
- WordPress Tag or Custom Taxonomy Return All Posts if has that Word in Post Title
- Filtering out child category posts from parent category archive not working
- WP Query – order posts by meta field first and then order the rest
- Exclude category by slug in pre_get_posts?
- pre_get_posts shows posts in random order sometimes
- post__in not working with pre_get_posts, but post__not_in does work
- Displaying number of search results for each post type
- WP_Query – How to get all posts of specific days of week by custom field date?
- Filter WooCommerce archive pages by an additional category
- Which filter/action should I use to serve content for “virtual” files
- date_query is showing duplicate results
- Exclude Posts Using Meta Query and User Meta
- admin uploads pre_get_posts not working as expected
- Adding a Theme Customizer Control for Posts_Per_Page
- Include attachments with a custom taxonomy in search
- Help with SQL query, how to add taxonomie terms with value stored in options?
- Looking for a way to exclude frontpage and nav menu from query filter