Run posts_where and posts_join only on the main query
Of course! I just had to set the $accepted_args parameter of add_filter() to 2. Like so: add_filter(‘posts_join’, ‘my_join’, 10, 2); function my_join($join, &$query) { echo $query->is_main_query() ? ‘y’ : ‘n’; return $join; }