WordPress wp_redirect problem : Warning: Cannot modify header information – headers already sent by…
I am creating a wordpress plugin of my own when I got stumble to this kind of error. An error that takes a lot of my time to resolve this kind of problem. I got into most of the forums about WordPress that has the same problem with mine. Some may have a smiling face with their solutions but I have a sad face since it does’nt solve the problem on my wordpress installed on my localhost server. I tried using headers instead of wp_redirect hoping there could be any changes of not using wp_redirect instead I use headers but still no changes at all. After a long hours of searching and playing pc games just to loosen the feeling of being frustrated of solving a one line code, I got into a forum and found the answer. This is another work around of redirecting without using wp_redirect.
Using wp_redirect in my plugin result to a Warning message : Cannot modify header information – headers already sent by… And did’nt get a redirected page that i need.
Instead of using wp_redirect , echo location using meta
<?php echo "<meta http-equiv=’refresh’ content=’0;url=$location’ />"; ?>
It works on my wordpress plugin. I hope it works in your installed wordpress.