wp_redirect() does not work in custom template file
Redirects are performed by outputting HTTP headers, wp_redirect() just adds some bits on top of it for flexibility. Headers are only ever meant to be used before any and all output to a page, since that is how HTTP response is structured. Hypothetically it could work in template if you make sure it fires before … Read more