Adds event to pre_get_posts.