Move do_url to a hook