Applying $posts_clauses filter to specific queries only
I had the same problem of needing to only apply $post_clauses to specific loops/queries and was able to use THIS solution provided by Stephen Harris: You can access query variables (including custom ones) via the WP_Query::get() method. For example: $my_query = new WP_Query( array( … ‘wpse105219_custom_var’ => ‘foobar’, … ) ); To ‘catch’ this at … Read more