• I need to put a HTML code (meta redirect) to the <head> section in my WP admin after a user submits a form and certain conditions are met. Unfortunately it seems that using add_action(‘admin_head’, ‘my_custom_admin_head’); doesn’t work if I put it in the function used for printing my options page.

    If it is anywhere else, it works, but then I would have to add an option to a database and constantly check it for changes to determine if the script is allowed put the redirect code to <head>.

    Isn’t there a way to achieve this in a simpler way?
    When I just use header() or wp_redirect() I get the “headers already sent” error.

    Thanks.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator bcworkz

    (@bcworkz)

    Are you able to output inline javascript as part of the form submit’s target?
    if ($myConditions == $formData) printf("<script>location.href='RedirectTarget.html'</script>");

    Thread Starter Devtard

    (@devtard)

    Yes, that works. But isn’t there a way to do it via PHP?

    I don’t really like JavaScript, but if there is no other solution I will consider using it.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Problem with using admin_head in my plugin’ is closed to new replies.