If you want to perform any redirects, you have to send your header before site sends any output.
admin_head
is an action that allows you to print your custom code inside <head>
tag of admin sites. But if it’s inside of <head>
, then some output is already sent to the browser, so you can’t perform any redirections any more.
As you can see here Actions Run During an Admin Page Request, the admin_head
is called after the scripts and styles are already printed.
So you should run your code using some hook that is fired before any output is sent to the browser. You can use wp
hook for example.
PS. Another thing is that you shouldn’t use header( "Location: admin.php?page=my-page&saved=1" );
. Using wp_redirect
would be much nicer way to do this.