You can try this modification to your code snippet:
function add_post_format_filter_to_posts( $query ) {
global $post_type, $pagenow;
// if we are currently on the edit screen of the post type listings
if ( is_admin()
&& $pagenow == 'edit.php'
&& $post_type == 'shop_order'
&& ! filter_input( INPUT_GET, 'filter_action' ) // <-- We add this check
&& ! filter_input( INPUT_GET, 'post_status' ) // <-- and this one
)
{
$query->set( 'date_query',
array(
array(
'column' => 'post_date_gmt',
'after' => '1 days ago',
)
)
);
}
}
add_action( 'pre_get_posts', 'add_post_format_filter_to_posts' );
where we only do the query filtering when the GET parameters filter_action
and post_status
aren’t set.
Related Posts:
- How to clear the cache?
- How to do a query only on a specific admin page?
- WP_Query pagination not working in admin area
- Use ‘parse_query’ filter to show posts that from multiple criteria
- hide custom post types with specific meta key ON admin backend
- Phpmyadmin – post editing
- Admin: Custom Query Returning Permissions Error
- WordPress AJAX Request returns 400
- How to use custom page for all posts with custom url, call another directory?
- Is it possible to give a classname to specific comments in the WordPress admin?
- How to set selected attribute on option after filter query?
- Way to include posts both with & without certain meta_key in args for wp_query?
- How to Access Global $multipage or Global $numpages outside the loop?
- How can I use WP-CLI commands without –allow-root
- Calling a wp_query $posts causes a 500 error
- Merging a complex query with post_rewind and splitting posts into two columns
- meta_query not working properly
- Filter wp_query to search post title in function
- Two queries on the same page with pagination
- Using tax_query reverses my post_type argument in a custom WP_Query
- Best approach to create Hot and Trending sections
- creating wp query with posts with specific category
- $wp_query->current_post restarts from zero on paged pages
- get complex results set according to category structure
- wp_get_post_terms of cpt but not duplicates if they are used more than once in the loop
- Setup of taxonomy term template pages
- Ignore post by meta value in the main query
- Display posts in 3 days chunk
- How to make orderby ‘meta_value_num’ OPTIONAL?
- WP_Query’s “request” SQL Query
- How to do a query on custom taxonomies that is uncategorised?
- Order taxonomy terms in alphabetical order
- is_search was called incorrectly
- Empty tax_query array returns an empty array
- Sorting By Custom Posts With Attachments
- Random loop with code to prevent duplicate output returns no output at all from time to time
- How to choose between hooking into per_get_posts or into parse_query
- Woocommerce returns Product post_status as published even tho it is in status draft
- remove query arg from url after set query
- How can I fix: “Notice: Undefined offset: 0”?
- SQL: What is wrong with the following query (generated by WordPress WP_Query, ordering prices)
- Order By table field comment_status in WordPress > 4.0
- Slow WP_Query for custom post type
- Most commented last 24h, week, month, year and all time – posts_where
- WP_Query Pagination on multiple-loop page breaks WP or doesn’t show up
- Why isn’t my `meta_query` array functioning properly?
- Using hook to use DISTINCT in a wp_query
- Overwrite YoastSEO meta-tags with another page’s [closed]
- Import wp users via one click demo option
- WP_query sorting can’t sort danish letters (æ, ø, å)
- Dynamic User Id
- Slow queries on a huge database
- Multisite pagination issue by multi query archive 404
- Hide elements outside loop based on query
- WP Query crashes on more than ~ 2000 posts
- different for loop if screen resolution < 1000px
- insert value from html into data base with wordpress
- Debugging wp_query orderby for taxonomy
- Pagination is not working with custom query inside a homepage template
- Issues with search after added meta_query
- How to load a script code only in posts?
- Display posts with specific value first in query
- Woocommerce: order posts by meta key
- Modify query posts
- Get posts with no tags?
- get_posts query matches too many results
- Sort by custom field that is an array?
- wp-query, pull children of parent page
- How to change tag based on metabox value within $wp_query
- What’s missing in this wp_query and meta_query
- Tax Query on product_cat using NOT IN as operator does not exclude that category
- How to use the Term Object from a custom select field in a query
- Random users always showing same 8 users
- meta_query order by date present -> future then show null
- whether a nonce is required for get type and get_query_var?
- Wp-query and column blocks
- Multi line of $wpdb->query just run 1 time and end the loop right after
- Sort posts on custom field AND after that sort on date?
- Get last child of given page by ID
- How to query users by post count no less than 10
- display the children of the post using the current page as the main parent
- Display 3 levels of categories on page
- Showing most popular post of week
- In Product Category archives how to show Posts having same/similar prod_cat slug structure?
- previous_posts_link not working in WordPress pagination
- Eliminate typical pages on search page, turn it into ajax search with “infinite” sized single page
- The sorting of posts by a meta_query with two keys fails while separated as single queries it works
- Hierarchical List Pages as a table
- WP_Query with several meta_query-statements and order by meta_value
- query_posts, oderby meta_value & print “future” posts
- Second wp_query doesn’t appear to be working
- difference between methods of query
- post__in not recognizing multiple IDs
- Why does WP_Query not search for two ‘meta_query’ keys separated with OR?
- How do I split a large query with a semi-expensive function included into multiple smaller queries
- Custom WP_query in Jnews theme returns thousands of posts
- wp_query loop with compare operator simply not working, why?
- WordPress WP_Query Search (‘s’) With Multiple Search Terms
- I want to place a post before all others from an ACF boleen field
- How to put posts with some taxonomy on top of others in `pre_get_posts`