Created
April 29, 2014 12:23
-
-
Save fazlurr/cb74d0562abdc6a5d2f3 to your computer and use it in GitHub Desktop.
WP redirect
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?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&noheader=true"> | |
| <p class="submit"> | |
| <input type="submit" class="button-primary" value="Submit form" /> | |
| </p> | |
| </form> | |
| </div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment