Exclude posts with certain meta data from search results
First, the pre_get_posts hook is an action and not a filter. Then the meta_query parameter should contain the relation only if there is more than one inner meta_query array (codex). Finally you do not need to return the $query argument as it is passed by reference to your callback function. Your code should look like … Read more