Looking at the WP_Query Class you should be able to use pre_get_posts
to modify the query before any other filters are run, which includes turning off the suppress_filters
flag. An example of this could be:
/**
* Modify WP_Queries
* @link https://wordpress.stackexchange.com/q/356950/7355
*
* @param WP_Query $query
*
* @return void
*/
function wpse356950_query_modifications( $query ) {
// Don't run on admin
if( is_admin() ) {
return;
}
// Some conditional to tell our query from other queries
if( $query->get( 'suppress_filters' ) ) {
$query->set( 'suppress_filters', false );
}
}
add_action( 'pre_get_posts', 'wpse356950_query_modifications' );
Related Posts:
- How to implement time filter to show random post 1 month for one category and 3 months for other categories
- Add class to first post in custom loop using post_class filter
- Filter Custom Taxonomy Posts
- Filter post query to only show direct children of category
- How to make posts unqueryable/unpublish posts where ACF relationship field is an unpublished post? [closed]
- filter posts by meta key with pagination
- Sorting query_posts() with a complex orderby filter
- query post based on comparison
- Some doubts about how the main query and the custom query works in this custom theme?
- Wp get all the sub pages of the parent using wp query
- Use REGEXP in WP_Query meta_query key
- Query Posts in a Predefined Order
- Changing Posts Per Page and offset with pre_get_posts
- ajax category filter
- How to get posts in different language from WPML Plugin [closed]
- Get posts by meta data OR title
- Using is_main_query to select custom post type on certain page
- WP_Query ordered by custom field that is a date string?
- Display Posts by modifying the where clause only for my query
- How to use filter hook posts_join for querying taxonomy terms in posts_where?
- How to Get All Posts but the Private ones?
- How to get any tag ID
- How to query ‘posts_per_page’ to display a different blog posts index template?
- Remove ellipsis from the excerpt retrieved using get_the_excerpt()
- WP query exclude post within the last month / only show over 1 month old
- WordPress query for most recent posts from multiple categories
- Too many posts cause slow load when paginating
- Use ‘parse_query’ filter to show posts that from multiple criteria
- How can I pick a single post from the latest 3?
- Query post with meta_query where date is not in future
- Using apply_filters(‘the_content’, $custom_query->post_content) alters output
- Modifying the Search Results
- Order a query result by a numeric meta key even if it does not exist, but put the posts with meta key first
- Query with custom taxonomy not working
- Query posts by specific word on title
- WP_Query last five posts, simply ordered by meta_value
- How to use filter hook “the_posts” with a function that refers to $this?
- WP_Query “OR”: Find posts by ID, Name or Post Title?
- Multiple loops without repeating content
- WP_Query condition affects posts_per_page count
- Order by title without taking into account ‘the’
- Custom Query num_rows returns wrong amount
- Fetch Record based on meta key dates
- Category applied to pages, creates multiple breadcrumb entries after a search query (On the translated site)
- add active class based on permalink and url
- Filtering out child category posts from parent category archive not working
- WP_Query with different postmeta filter for each categories
- Display custom tags on pages that have a specific page parent
- Slow WP_Query with ‘OR’ on meta_query
- Add posts to WP Query object
- How to query for all posts that have a particular meta key?
- Advanced WP Query and/or
- How can I override one post and make it display content for another post?
- Get all posts which was posted on X Days WordPress
- How to create custom query by keyword in post title?
- Conditional operator OR not working with custom fields
- WP_Query – How to get all posts of specific days of week by custom field date?
- 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
- How can I comment comma-separated array values?
- How to use ‘WP_Query’ or ‘query_posts’ to display content in a descending order
- Filtering by multiple conditions in the loop
- 2 queries with counters
- Max Posts and Memory Limit
- Multiple Query_Posts
- Custom post type – filter content by custom meta box content
- Magazine style frontpage with multiple categories/loops and no duplicate posts
- Display posts ONLY from the current logged in user and current week/year/month Elementor posts
- Custom meta_query order for Elementor based on post meta key [closed]
- query hook parse_tax_query function takes no effect
- Duplice post with standard WP loop – fixed by using query_posts() instead
- ElasticPress is (aparently) messing with my search filters
- get_posts function not returning any results
- Categories In English version showing not canonical URL, instead shows query search result
- Order by meta date with a thousanth of a second defaults to post order
- Custom query for custom post type not getting correct post ID
- Problem with my loops
- WP Query filters active on wrong query
- Insert wp_query after the_content with plugin (filter the_content won’t work)
- Gather same custom field values in one value in a select tag with wp_query
- Merge two queries and remove duplicate
- How to add in WP_Query to every 3 posts displayed? [duplicate]
- Seach and categories not working when ignoring sticky posts in main loop
- posts_per_page increment additional post
- Track write actions to the database
- Calling body_class and wp_nav_menu for a different post
- Fetch only categorized posts
- Modify query to exclude certain ids and certain parents and its corresponding children
- how to exclude store in clipper theme wordpress code php
- Display post list within category list sorted by name [duplicate]
- When should you use WP_Query vs query_posts() vs get_posts()?
- How to query post ids liked by the Author
- get contents and permalink from a specified page
- Help in query for list links
- WordPress pagination returns the same posts
- Incorrect posts displayed on category page
- Woocommerce set loop_shop_columns to be 3 in the main shop page loop only and 4 otherwise
- List categories using WP_Query
- WP Query – Show custom posts only if user contain some user meta