fazlurr
4/29/2014 - 12:23 PM

WP redirect

WP redirect

<?php
if (isset($_POST))
{
    $error_found = FALSE;
 
    //  Some input field checking
 
    if ($error_found == FALSE)
    {
        //  Use the wp redirect function
        wp_redirect(get_option('siteurl').'/wp-admin/options-general.php?page=my_plugin_page2/my_plugin_page2.php');
    }
    else
    {
        //  Some errors were found, so let's output the header since we are staying on this page
        if (isset($_GET['noheader']))
            require_once(ABSPATH . 'wp-admin/admin-header.php');
    }
}
?>
<div class="wrap">
    <h2>wp_redirect test</h2>
    <form method="post" action="<?php echo get_option('siteurl'); ?>/wp-admin/options-general.php?page=my_plugin/my_plugin.php&amp;noheader=true">
        <p class="submit">
            <input type="submit" class="button-primary" value="Submit form" />
        </p>
    </form>
</div>