When using redirect functions such as header(‘Location: http://example.com/’) or built-in WordPress functions such as wp_redirect, you must write the get_header() function before. Otherwise it will cause the above error.
Avoid error: Cannot modify header information – headers already sent by
Posted on by Admin