How to send “Location” header on plugin form submit event?
You’re trying to send a redirect header on the admin_menu action, which is fired after some of the page has been sent to the browser. You have to hook an earlier action before output starts, like init. add_action( ‘init’, ‘wpa_test’ ); function wpa_test() { if(isset($_POST[‘submit’])) { wp_redirect( home_url() ); exit; } }