Change force rewrite to use `wp_head` hook instead of `get_header`, fixes #817