wp_redirect()
– headers already sent. Instead of using the function I added an action to “wp_loaded”, that makes sure that it gets loaded before any headers are sended.
1 2 3 4 5 6 7 8 9 10 11 | <?php add_action ('wp_loaded', 'my_custom_redirect'); function my_custom_redirect() { if ( isset( $_POST['subscribe'] ) ) { $redirect = 'http://example.com/redirect-example-url.html'; wp_redirect($redirect); exit; } } ?> |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.