Make WordPress Core

Ticket #25207: 25207.diff

File 25207.diff, 63.1 KB (added by DrewAPicture, 12 years ago)
  • wp-activate.php

     
    1313
    1414require( './wp-blog-header.php' );
    1515
    16 if ( !is_multisite() ) {
    17         wp_redirect( site_url( '/wp-login.php?action=register' ) );
    18         die();
     16if ( ! is_multisite() ) {
     17        if ( wp_redirect( site_url( '/wp-login.php?action=register' ) ) )
     18                die();
    1919}
    2020
    2121if ( is_object( $wp_object_cache ) )
  • wp-admin/admin.php

     
    4242         */
    4343        do_action('after_db_upgrade');
    4444} elseif ( get_option('db_version') != $wp_db_version && empty($_POST) ) {
    45         if ( !is_multisite() ) {
    46                 wp_redirect( admin_url( 'upgrade.php?_wp_http_referer=' . urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ) ) );
    47                 exit;
     45        if ( ! is_multisite() ) {
     46                $request_uri = urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) );
     47                if ( wp_redirect( admin_url( 'upgrade.php?_wp_http_referer=' . $request_uri ) ) );
     48                        exit;
    4849        } elseif ( apply_filters( 'do_mu_upgrade', true ) ) {
    4950                /**
    5051                 * On really small MU installs run the upgrader every time,
     
    122123                                $query_string = $_SERVER[ 'QUERY_STRING' ];
    123124                        else
    124125                                $query_string = 'page=' . $plugin_page;
    125                         wp_redirect( admin_url('tools.php?' . $query_string) );
    126                         exit;
     126
     127                        if ( wp_redirect( admin_url('tools.php?' . $query_string) ) );
     128                                exit;
    127129                }
    128130        }
    129131        unset($the_parent);
     
    175177        if ( ! current_user_can('import') )
    176178                wp_die(__('You are not allowed to import.'));
    177179
    178         if ( validate_file($importer) ) {
    179                 wp_redirect( admin_url( 'import.php?invalid=' . $importer ) );
    180                 exit;
     180        if ( validate_file( $importer ) ) {
     181                if ( wp_redirect( admin_url( 'import.php?invalid=' . $importer ) ) )
     182                        exit;
    181183        }
    182184
    183185        if ( ! isset($wp_importers[$importer]) || ! is_callable($wp_importers[$importer][2]) ) {
    184                 wp_redirect( admin_url( 'import.php?invalid=' . $importer ) );
    185                 exit;
     186                if ( wp_redirect( admin_url( 'import.php?invalid=' . $importer ) ) )
     187                        exit;
    186188        }
    187189
    188190        do_action( 'load-importer-' . $importer );
  • wp-admin/comment.php

     
    8888
    8989        $comment_id = absint( $_GET['c'] );
    9090
    91         if ( !$comment = get_comment_to_edit( $comment_id ) ) {
    92                 wp_redirect( admin_url('edit-comments.php?error=1') );
    93                 die();
     91        if ( ! $comment = get_comment_to_edit( $comment_id ) ) {
     92                if ( wp_redirect( admin_url('edit-comments.php?error=1') ) )
     93                        die();
    9494        }
    9595
    96         if ( !current_user_can( 'edit_comment', $comment->comment_ID ) ) {
    97                 wp_redirect( admin_url('edit-comments.php?error=2') );
    98                 die();
     96        if ( ! current_user_can( 'edit_comment', $comment->comment_ID ) ) {
     97                if ( wp_redirect( admin_url('edit-comments.php?error=2') ) )
     98                        die();
    9999        }
    100100
    101101        // No need to re-approve/re-trash/re-spam a comment.
    102102        if ( $action == str_replace( '1', 'approve', $comment->comment_approved ) ) {
    103                 wp_redirect( admin_url( 'edit-comments.php?same=' . $comment_id ) );
    104                 die();
     103                if ( wp_redirect( admin_url( 'edit-comments.php?same=' . $comment_id ) ) )
     104                        die();
    105105        }
    106106
    107107        require_once('./admin-header.php');
     
    265265                        break;
    266266        }
    267267
    268         wp_redirect( $redir );
    269         die;
     268        if ( wp_redirect( $redir ) )
     269                die;
     270
    270271        break;
    271272
    272273case 'editedcomment' :
     
    280281
    281282        $location = ( empty( $_POST['referredby'] ) ? "edit-comments.php?p=$comment_post_id" : $_POST['referredby'] ) . '#comment-' . $comment_id;
    282283        $location = apply_filters( 'comment_edit_redirect', $location, $comment_id );
    283         wp_redirect( $location );
     284        if ( wp_redirect( $location ) )
     285                exit();
    284286
    285         exit();
    286287        break;
    287288
    288289default:
  • wp-admin/edit-comments.php

     
    9595        wp_safe_redirect( $redirect_to );
    9696        exit;
    9797} elseif ( ! empty( $_GET['_wp_http_referer'] ) ) {
    98          wp_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce' ), wp_unslash( $_SERVER['REQUEST_URI'] ) ) );
    99         exit;
     98         if ( wp_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce' ), wp_unslash( $_SERVER['REQUEST_URI'] ) ) ) )
     99                exit;
    100100}
    101101
    102102$wp_list_table->prepare_items();
  • wp-admin/edit-tags.php

     
    6161                $location = add_query_arg( 'message', 1, $location );
    6262        else
    6363                $location = add_query_arg( 'message', 4, $location );
    64         wp_redirect( $location );
    65         exit;
     64
     65        if ( wp_redirect( $location ) )
     66                exit;
     67
    6668break;
    6769
    6870case 'delete':
     
    7476                        $location = $referer;
    7577        }
    7678
    77         if ( !isset( $_REQUEST['tag_ID'] ) ) {
    78                 wp_redirect( $location );
     79        if ( ! isset( $_REQUEST['tag_ID'] ) && wp_redirect( $location ) )
    7980                exit;
    80         }
    8181
    8282        $tag_ID = (int) $_REQUEST['tag_ID'];
    8383        check_admin_referer( 'delete-tag_' . $tag_ID );
     
    8888        wp_delete_term( $tag_ID, $taxonomy );
    8989
    9090        $location = add_query_arg( 'message', 2, $location );
    91         wp_redirect( $location );
    92         exit;
    9391
     92        if ( wp_redirect( $location ) )
     93                exit;
     94
    9495break;
    9596
    9697case 'bulk-delete':
     
    113114        }
    114115
    115116        $location = add_query_arg( 'message', 6, $location );
    116         wp_redirect( $location );
    117         exit;
    118117
     118        if ( wp_redirect( $location ) )
     119                exit;
     120
    119121break;
    120122
    121123case 'edit':
     
    158160        else
    159161                $location = add_query_arg( 'message', 5, $location );
    160162
    161         wp_redirect( $location );
    162         exit;
     163        if ( wp_redirect( $location ) )
     164                exit;
     165
    163166break;
    164167
    165168default:
     
    169172        if ( ! empty( $_REQUEST['paged'] ) )
    170173                $location = add_query_arg( 'paged', (int) $_REQUEST['paged'] );
    171174
    172         wp_redirect( $location );
    173         exit;
     175        if ( wp_redirect( $location ) )
     176                exit;
    174177}
    175178
    176179$wp_list_table->prepare_items();
    177180$total_pages = $wp_list_table->get_pagination_arg( 'total_pages' );
    178181
    179182if ( $pagenum > $total_pages && $total_pages > 0 ) {
    180         wp_redirect( add_query_arg( 'paged', $total_pages ) );
    181         exit;
     183        if ( wp_redirect( add_query_arg( 'paged', $total_pages ) ) )
     184                exit;
    182185}
    183186
    184187wp_enqueue_script('admin-tags');
  • wp-admin/edit.php

     
    2727// Back-compat for viewing comments of an entry
    2828foreach ( array( 'p', 'attachment_id', 'page_id' ) as $_redirect ) {
    2929        if ( ! empty( $_REQUEST[ $_redirect ] ) ) {
    30                 wp_redirect( admin_url( 'edit-comments.php?p=' . absint( $_REQUEST[ $_redirect ] ) ) );
    31                 exit;
     30                if ( wp_redirect( admin_url( 'edit-comments.php?p=' . absint( $_REQUEST[ $_redirect ] ) ) ) )
     31                        exit;
    3232        }
    3333}
    3434unset( $_redirect );
     
    6868                $post_ids = array_map('intval', $_REQUEST['post']);
    6969        }
    7070
    71         if ( !isset( $post_ids ) ) {
    72                 wp_redirect( $sendback );
    73                 exit;
     71        if ( ! isset( $post_ids ) ) {
     72                if ( wp_redirect( $sendback ) )
     73                        exit;
    7474        }
    7575
    7676        switch ( $doaction ) {
     
    142142
    143143        $sendback = remove_query_arg( array('action', 'action2', 'tags_input', 'post_author', 'comment_status', 'ping_status', '_status', 'post', 'bulk_edit', 'post_view'), $sendback );
    144144
    145         wp_redirect($sendback);
    146         exit();
     145        if ( wp_redirect( $sendback ) )
     146                exit();
    147147} elseif ( ! empty($_REQUEST['_wp_http_referer']) ) {
    148          wp_redirect( remove_query_arg( array('_wp_http_referer', '_wpnonce'), wp_unslash($_SERVER['REQUEST_URI']) ) );
    149         exit;
     148         if ( wp_redirect( remove_query_arg( array('_wp_http_referer', '_wpnonce'), wp_unslash($_SERVER['REQUEST_URI']) ) ) )
     149                exit;
    150150}
    151151
    152152$wp_list_table->prepare_items();
  • wp-admin/import.php

     
    3838if ( ! empty( $_GET['invalid'] ) && isset( $popular_importers[ $_GET['invalid'] ] ) ) {
    3939        $importer_id = $popular_importers[ $_GET['invalid'] ]['importer-id'];
    4040        if ( $importer_id != $_GET['invalid'] ) { // Prevent redirect loops.
    41                 wp_redirect( admin_url( 'admin.php?import=' . $importer_id ) );
    42                 exit;
     41                if ( wp_redirect( admin_url( 'admin.php?import=' . $importer_id ) ) )
     42                        exit;
    4343        }
    4444        unset( $importer_id );
    4545}
  • wp-admin/includes/class-wp-list-table.php

     
    145145
    146146                // redirect if page number is invalid and headers are not already sent
    147147                if ( ! headers_sent() && ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX ) && $args['total_pages'] > 0 && $this->get_pagenum() > $args['total_pages'] ) {
    148                         wp_redirect( add_query_arg( 'paged', $args['total_pages'] ) );
    149                         exit;
     148                        if ( wp_redirect( add_query_arg( 'paged', $args['total_pages'] ) ) )
     149                                exit;
    150150                }
    151151
    152152                $this->_pagination_args = $args;
  • wp-admin/includes/dashboard.php

     
    135135                ob_start(); // hack - but the same hack wp-admin/widgets.php uses
    136136                wp_dashboard_trigger_widget_control( $_POST['widget_id'] );
    137137                ob_end_clean();
    138                 wp_redirect( remove_query_arg( 'edit' ) );
    139                 exit;
     138                if ( wp_redirect( remove_query_arg( 'edit' ) ) )
     139                        exit;
    140140        }
    141141
    142142        if ( $update )
  • wp-admin/includes/plugin.php

     
    534534                return $valid;
    535535
    536536        if ( !in_array($plugin, $current) ) {
    537                 if ( !empty($redirect) )
    538                         wp_redirect(add_query_arg('_error_nonce', wp_create_nonce('plugin-activation-error_' . $plugin), $redirect)); // we'll override this later if the plugin can be included without fatal error
     537                if ( ! empty( $redirect ) ) {
     538                        // we'll override this later if the plugin can be included without fatal error
     539                        if ( wp_redirect( add_query_arg( '_error_nonce', wp_create_nonce( 'plugin-activation-error_' . $plugin ), $redirect ) ) )
     540                                exit;
     541                }
     542
    539543                ob_start();
    540544                include_once(WP_PLUGIN_DIR . '/' . $plugin);
    541545
  • wp-admin/link-manager.php

     
    2727                        wp_delete_link( $link_id );
    2828                }
    2929
    30                 wp_redirect( add_query_arg('deleted', count( $bulklinks ), admin_url( 'link-manager.php' ) ) );
    31                 exit;
     30                if ( wp_redirect( add_query_arg('deleted', count( $bulklinks ), admin_url( 'link-manager.php' ) ) ) )
     31                        exit;
    3232        }
    3333} elseif ( ! empty( $_GET['_wp_http_referer'] ) ) {
    34          wp_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce' ), wp_unslash( $_SERVER['REQUEST_URI'] ) ) );
    35         exit;
     34         if ( wp_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce' ), wp_unslash( $_SERVER['REQUEST_URI'] ) ) ) )
     35                exit;
    3636}
    3737
    3838$wp_list_table->prepare_items();
  • wp-admin/link.php

     
    3131                check_admin_referer('bulk-bookmarks');
    3232
    3333                //for each link id (in $linkcheck[]) change category to selected value
    34                 if (count($linkcheck) == 0) {
    35                         wp_redirect($this_file);
     34                if ( count( $linkcheck ) == 0 && wp_redirect( $this_file ) )
    3635                        exit;
    37                 }
    3836
    3937                $deleted = 0;
    4038                foreach ($linkcheck as $link_id) {
     
    4442                                $deleted++;
    4543                }
    4644
    47                 wp_redirect("$this_file?deleted=$deleted");
    48                 exit;
     45                if ( wp_redirect( "$this_file?deleted=$deleted" ) )
     46                        exit;
    4947                break;
    5048
    5149        case 'move' :
    5250                check_admin_referer('bulk-bookmarks');
    5351
    5452                //for each link id (in $linkcheck[]) change category to selected value
    55                 if (count($linkcheck) == 0) {
    56                         wp_redirect($this_file);
     53                if (count($linkcheck) == 0 && wp_redirect( $this_file ) )
    5754                        exit;
    58                 }
     55
    5956                $all_links = join(',', $linkcheck);
    6057                // should now have an array of links we can change
    6158                //$q = $wpdb->query("update $wpdb->links SET link_category='$category' WHERE link_id IN ($all_links)");
    6259
    63                 wp_redirect($this_file);
    64                 exit;
     60                if ( wp_redirect( $this_file ) )
     61                        exit;
     62
    6563                break;
    6664
    6765        case 'add' :
     
    7169                if ( add_link() )
    7270                        $redir = add_query_arg( 'added', 'true', $redir );
    7371
    74                 wp_redirect( $redir );
    75                 exit;
     72                if ( wp_redirect( $redir ) )
     73                        exit;
     74
    7675                break;
    7776
    7877        case 'save' :
     
    8180
    8281                edit_link($link_id);
    8382
    84                 wp_redirect($this_file);
    85                 exit;
     83                if ( wp_redirect( $this_file ) )
     84                        exit;
     85
    8686                break;
    8787
    8888        case 'delete' :
     
    9191
    9292                wp_delete_link($link_id);
    9393
    94                 wp_redirect($this_file);
    95                 exit;
     94                if ( wp_redirect( $this_file ) )
     95                        exit;
     96
    9697                break;
    9798
    9899        case 'edit' :
  • wp-admin/media-new.php

     
    3333                if ( is_wp_error( $id ) )
    3434                        $location .= '?message=3';
    3535        }
    36         wp_redirect( admin_url( $location ) );
    37         exit;
     36
     37        if ( wp_redirect( admin_url( $location ) ) )
     38                exit;
    3839}
    3940
    4041$title = __('Upload New Media');
  • wp-admin/media.php

     
    3636                } elseif ( false !== strpos($location, 'media.php') ) {
    3737                        $location = add_query_arg('message', 'updated', $location);
    3838                }
    39                 wp_redirect($location);
    40                 exit;
     39                if ( wp_redirect( $location ) )
     40                        exit;
    4141        }
    4242
    4343        // no break
     
    4848                $errors = null;
    4949
    5050        if ( empty( $_GET['attachment_id'] ) ) {
    51                 wp_redirect( admin_url('upload.php') );
    52                 exit();
     51                if ( wp_redirect( admin_url('upload.php') ) )
     52                        exit();
    5353        }
    5454        $att_id = (int) $_GET['attachment_id'];
    5555
     
    141141        exit;
    142142
    143143default:
    144         wp_redirect( admin_url('upload.php') );
    145         exit;
     144        if ( wp_redirect( admin_url('upload.php') ) )
     145                exit;
    146146
    147147endswitch;
  • wp-admin/moderation.php

     
    88 * @subpackage Administration
    99 */
    1010require_once('../wp-load.php');
    11 wp_redirect( admin_url('edit-comments.php?comment_status=moderated') );
    12 exit;
     11if ( wp_redirect( admin_url('edit-comments.php?comment_status=moderated') ) )
     12        exit;
  • wp-admin/ms-admin.php

     
    99
    1010require_once( './admin.php' );
    1111
    12 wp_redirect( network_admin_url() );
    13 exit;
     12if ( wp_redirect( network_admin_url() ) )
     13        exit;
  • wp-admin/ms-edit.php

     
    99
    1010require_once( './admin.php' );
    1111
    12 wp_redirect( network_admin_url() );
    13 exit;
     12if ( wp_redirect( network_admin_url() ) )
     13        exit;
  • wp-admin/ms-options.php

     
    99
    1010require_once( './admin.php' );
    1111
    12 wp_redirect( network_admin_url('settings.php') );
    13  No newline at end of file
     12if ( wp_redirect( network_admin_url('settings.php') ) )
     13        exit;
     14 No newline at end of file
  • wp-admin/ms-sites.php

     
    99
    1010require_once( './admin.php' );
    1111
    12 wp_redirect( network_admin_url('sites.php') );
    13 exit;
     12if ( wp_redirect( network_admin_url('sites.php') ) )
     13        exit;
  • wp-admin/ms-themes.php

     
    99
    1010require_once( './admin.php' );
    1111
    12 wp_redirect( network_admin_url('themes.php') );
    13 exit;
     12if ( wp_redirect( network_admin_url('themes.php') ) )
     13        exit;
  • wp-admin/ms-upgrade-network.php

     
    99
    1010require_once('admin.php');
    1111
    12 wp_redirect( network_admin_url('upgrade.php') );
    13 exit;
     12if ( wp_redirect( network_admin_url('upgrade.php') ) )
     13        exit;
  • wp-admin/ms-users.php

     
    99
    1010require_once( './admin.php' );
    1111
    12 wp_redirect( network_admin_url('users.php') );
    13 exit;
     12if ( wp_redirect( network_admin_url('users.php') ) )
     13        exit;
  • wp-admin/nav-menus.php

     
    315315                                                set_theme_mod( 'nav_menu_locations', $menu_locations );
    316316                                        }
    317317                                        // $messages[] = '<div id="message" class="updated"><p>' . sprintf( __( '<strong>%s</strong> has been created.' ), $nav_menu_selected_title ) . '</p></div>';
    318                                         wp_redirect( admin_url( 'nav-menus.php?menu=' . $_nav_menu_selected_id ) );
    319                                         exit();
     318
     319                                        if ( wp_redirect( admin_url( 'nav-menus.php?menu=' . $_nav_menu_selected_id ) ) )
     320                                                exit();
    320321                                }
    321322                        } else {
    322323                                $messages[] = '<div id="message" class="error"><p>' . __( 'Please enter a valid menu name.' ) . '</p></div>';
     
    351352                }
    352353                break;
    353354        case 'locations':
    354                 if ( ! $num_locations ) {
    355                         wp_redirect( admin_url( 'nav-menus.php' ) );
     355                if ( ! $num_locations && wp_redirect( admin_url( 'nav-menus.php' ) ) )
    356356                        exit();
    357                 }
    358357
    359358                add_filter( 'screen_options_show_screen', '__return_false' );
    360359
     
    406405
    407406// Redirect to add screen if there are no menus and this users has either zero, or more than 1 theme locations
    408407if ( 0 == $menu_count && ! $add_new_screen && ! $one_theme_location_no_menus )
    409         wp_redirect( admin_url( 'nav-menus.php?action=edit&menu=0' ) );
     408        if ( wp_redirect( admin_url( 'nav-menus.php?action=edit&menu=0' ) ) )
     409                exit;
    410410
    411411// Get recently edited nav menu
    412412$recently_edited = absint( get_user_option( 'nav_menu_recently_edited' ) );
  • wp-admin/network/admin.php

     
    1717
    1818$redirect_network_admin_request = ( ( $current_blog->domain != $current_site->domain ) || ( $current_blog->path != $current_site->path ) );
    1919$redirect_network_admin_request = apply_filters( 'redirect_network_admin_request', $redirect_network_admin_request );
    20 if ( $redirect_network_admin_request ) {
    21         wp_redirect( network_admin_url() );
     20
     21if ( $redirect_network_admin_request && wp_redirect( network_admin_url() ) )
    2222        exit;
    23 }
     23
    2424unset( $redirect_network_admin_request );
  • wp-admin/network/edit.php

     
    1313if ( ! is_multisite() )
    1414        wp_die( __( 'Multisite support is not enabled.' ) );
    1515
    16 if ( empty( $_GET['action'] ) ) {
    17         wp_redirect( network_admin_url() );
     16if ( empty( $_GET['action'] ) && wp_redirect( network_admin_url() ) )
    1817        exit;
    19 }
    2018
    2119do_action( 'wpmuadminedit' , '' );
    2220
    2321// Let plugins use us as a post handler easily
    2422do_action( 'network_admin_edit_' . $_GET['action'] );
    2523
    26 wp_redirect( network_admin_url() );
    27 exit();
     24if ( wp_redirect( network_admin_url() ) )
     25        exit();
  • wp-admin/network/settings.php

     
    6767        // Update more options here
    6868        do_action( 'update_wpmu_options' );
    6969
    70         wp_redirect( add_query_arg( 'updated', 'true', network_admin_url( 'settings.php' ) ) );
    71         exit();
     70        if ( wp_redirect( add_query_arg( 'updated', 'true', network_admin_url( 'settings.php' ) ) ) )
     71                exit();
    7272}
    7373
    7474include( '../admin-header.php' );
  • wp-admin/network/site-info.php

     
    7474        update_blog_details( $id, $blog_data );
    7575
    7676        restore_current_blog();
    77         wp_redirect( add_query_arg( array( 'update' => 'updated', 'id' => $id ), 'site-info.php') );
    78         exit;
     77        if ( wp_redirect( add_query_arg( array( 'update' => 'updated', 'id' => $id ), 'site-info.php') ) )
     78                exit;
    7979}
    8080
    8181if ( isset($_GET['update']) ) {
  • wp-admin/network/site-new.php

     
    9191Name: %3$s' ), $current_user->user_login , get_site_url( $id ), wp_unslash( $title ) );
    9292                wp_mail( get_site_option('admin_email'), sprintf( __( '[%s] New Site Created' ), $current_site->site_name ), $content_mail, 'From: "Site Admin" <' . get_site_option( 'admin_email' ) . '>' );
    9393                wpmu_welcome_notification( $id, $user_id, $password, $title, array( 'public' => 1 ) );
    94                 wp_redirect( add_query_arg( array( 'update' => 'added', 'id' => $id ), 'site-new.php' ) );
    95                 exit;
     94                if ( wp_redirect( add_query_arg( array( 'update' => 'added', 'id' => $id ), 'site-new.php' ) ) )
     95                        exit;
    9696        } else {
    9797                wp_die( $id->get_error_message() );
    9898        }
  • wp-admin/network/site-settings.php

     
    6060
    6161        do_action( 'wpmu_update_blog_options' );
    6262        restore_current_blog();
    63         wp_redirect( add_query_arg( array( 'update' => 'updated', 'id' => $id ), 'site-settings.php') );
    64         exit;
     63        if ( wp_redirect( add_query_arg( array( 'update' => 'updated', 'id' => $id ), 'site-settings.php') ) )
     64                exit;
    6565}
    6666
    6767if ( isset($_GET['update']) ) {
  • wp-admin/network/sites.php

     
    138138                                        }
    139139                                }
    140140                        } else {
    141                                 wp_redirect( network_admin_url( 'sites.php' ) );
    142                                 exit();
     141                                if ( wp_redirect( network_admin_url( 'sites.php' ) ) )
     142                                        exit();
    143143                        }
    144144                break;
    145145
  • wp-admin/network/themes.php

     
    3535                        check_admin_referer('enable-theme_' . $_GET['theme']);
    3636                        $allowed_themes[ $_GET['theme'] ] = true;
    3737                        update_site_option( 'allowedthemes', $allowed_themes );
    38                         if ( false === strpos( $referer, '/network/themes.php' ) )
    39                                 wp_redirect( network_admin_url( 'themes.php?enabled=1' ) );
    40                         else
    41                                 wp_safe_redirect( add_query_arg( 'enabled', 1, $referer ) );
    42                         exit;
     38                        if ( false === strpos( $referer, '/network/themes.php' ) ) {
     39                                if ( wp_redirect( network_admin_url( 'themes.php?enabled=1' ) ) )
     40                                        exit;
     41                        } else {
     42                                if ( wp_safe_redirect( add_query_arg( 'enabled', 1, $referer ) ) )
     43                                        exit;
     44                        }
    4345                        break;
    4446                case 'disable':
    4547                        check_admin_referer('disable-theme_' . $_GET['theme']);
     
    186188                        }
    187189                       
    188190                        $paged = ( $_REQUEST['paged'] ) ? $_REQUEST['paged'] : 1;
    189                         wp_redirect( add_query_arg( array(
     191                        if ( wp_redirect( add_query_arg( array(
    190192                                'deleted' => count( $themes ),
    191193                                'paged' => $paged,
    192194                                's' => $s
    193                         ), network_admin_url( 'themes.php' ) ) );
    194                         exit;
     195                        ), network_admin_url( 'themes.php' ) ) ) )
     196                                exit;
     197
    195198                        break;
    196199        }
    197200}
  • wp-admin/network/user-new.php

     
    5151                        $add_user_errors = new WP_Error( 'add_user_fail', __( 'Cannot add user.' ) );
    5252                } else {
    5353                        wp_new_user_notification( $user_id, $password );
    54                         wp_redirect( add_query_arg( array('update' => 'added'), 'user-new.php' ) );
    55                         exit;
     54                        if ( wp_redirect( add_query_arg( array('update' => 'added'), 'user-new.php' ) ) )
     55                                exit;
    5656                }
    5757        }
    5858}
  • wp-admin/network/users.php

     
    107107                                echo '</div>';
    108108                    require_once( '../admin-footer.php' );
    109109                        } else {
    110                                 wp_redirect( network_admin_url( 'users.php' ) );
     110                                if ( wp_redirect( network_admin_url( 'users.php' ) ) )
     111                                        exit;
    111112                        }
    112113                        exit();
    113114                break;
     
    170171
    171172                                if ( ! empty( $_REQUEST['paged'] ) )
    172173                                        $location = add_query_arg( 'paged', (int) $_REQUEST['paged'], $location );
    173                                 wp_redirect( $location );
     174                                if ( wp_redirect( $location ) )
     175                                        exit;
    174176                        }
    175177                        exit();
    176178                break;
     
    207209                        else
    208210                                $deletefunction = 'all_delete';
    209211
    210                         wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => $deletefunction ), network_admin_url( 'users.php' ) ) );
    211                         exit();
     212                        if ( wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => $deletefunction ), network_admin_url( 'users.php' ) ) ) )
     213                                exit();
    212214                break;
    213215        }
    214216}
     
    219221$total_pages = $wp_list_table->get_pagination_arg( 'total_pages' );
    220222
    221223if ( $pagenum > $total_pages && $total_pages > 0 ) {
    222         wp_redirect( add_query_arg( 'paged', $total_pages ) );
    223         exit;
     224        if ( wp_redirect( add_query_arg( 'paged', $total_pages ) ) )
     225                exit;
    224226}
    225227$title = __( 'Users' );
    226228$parent_file = 'users.php';
  • wp-admin/network.php

     
    1919        wp_die( __( 'You do not have sufficient permissions to manage options for this site.' ) );
    2020
    2121if ( is_multisite() ) {
    22         if ( ! is_network_admin() ) {
    23                 wp_redirect( network_admin_url( 'setup.php' ) );
     22        if ( ! is_network_admin() && wp_redirect( network_admin_url( 'setup.php' ) ) )
    2423                exit;
    25         }
     24
    2625        if ( ! defined( 'MULTISITE' ) )
    2726                wp_die( __( 'The Network creation panel is not for WordPress MU networks.' ) );
    2827}
  • wp-admin/options-permalink.php

     
    113113                $wp_rewrite->set_tag_base( $tag_base );
    114114        }
    115115
    116         wp_redirect( admin_url( 'options-permalink.php?settings-updated=true' ) );
    117         exit;
     116        if ( wp_redirect( admin_url( 'options-permalink.php?settings-updated=true' ) ) )
     117                exit;
    118118}
    119119
    120120$permalink_structure = get_option('permalink_structure');
  • wp-admin/options.php

     
    4545                        delete_option( 'new_admin_email' );
    4646                        $redirect = 'options-general.php?updated=true';
    4747                }
    48                 wp_redirect( admin_url( $redirect ) );
    49                 exit;
     48
     49                if ( wp_redirect( admin_url( $redirect ) ) )
     50                        exit;
    5051        } elseif ( ! empty( $_GET['dismiss'] ) && 'new_admin_email' == $_GET['dismiss'] ) {
    5152                delete_option( 'adminhash' );
    5253                delete_option( 'new_admin_email' );
    53                 wp_redirect( admin_url( 'options-general.php?updated=true' ) );
    54                 exit;
     54
     55                if ( wp_redirect( admin_url( 'options-general.php?updated=true' ) ) )
     56                        exit;
    5557        }
    5658}
    5759
     
    168170         * Redirect back to the settings page that was submitted
    169171         */
    170172        $goback = add_query_arg( 'settings-updated', 'true',  wp_get_referer() );
    171         wp_redirect( $goback );
    172         exit;
     173
     174        if ( wp_redirect( $goback ) )
     175                exit;
    173176}
    174177
    175178include('./admin-header.php'); ?>
  • wp-admin/plugin-editor.php

     
    1010require_once('./admin.php');
    1111
    1212if ( is_multisite() && ! is_network_admin() ) {
    13         wp_redirect( network_admin_url( 'plugin-editor.php' ) );
    14         exit();
     13        if ( wp_redirect( network_admin_url( 'plugin-editor.php' ) ) )
     14                exit();
    1515}
    1616
    1717if ( !current_user_can('edit_plugins') )
     
    6565                        if ( ! is_network_admin() )
    6666                                update_option( 'recently_activated', array( $file => time() ) + (array) get_option( 'recently_activated' ) );
    6767
    68                         wp_redirect(add_query_arg('_wpnonce', wp_create_nonce('edit-plugin-test_' . $file), "plugin-editor.php?file=$file&liveupdate=1&scrollto=$scrollto&networkwide=" . $network_wide));
     68                        $update_url = wp_create_nonce( 'edit-plugin-test_' . $file), "plugin-editor.php?file=$file&liveupdate=1&scrollto=$scrollto&networkwide=" . $network_wide;
     69                        if ( wp_redirect( add_query_arg('_wpnonce', $update_url ) ) )
     70                                exit;
     71                }
     72                if ( wp_redirect( self_admin_url("plugin-editor.php?file=$file&a=te&scrollto=$scrollto") ) )
    6973                        exit;
    70                 }
    71                 wp_redirect( self_admin_url("plugin-editor.php?file=$file&a=te&scrollto=$scrollto") );
    7274        } else {
    73                 wp_redirect( self_admin_url("plugin-editor.php?file=$file&scrollto=$scrollto") );
     75                if ( wp_redirect( self_admin_url("plugin-editor.php?file=$file&scrollto=$scrollto") ) )
     76                        exit;
    7477        }
    7578        exit;
    7679
     
    8891                if ( ( ! empty( $_GET['networkwide'] ) && ! is_plugin_active_for_network($file) ) || ! is_plugin_active($file) )
    8992                        activate_plugin($file, "plugin-editor.php?file=$file&phperror=1", ! empty( $_GET['networkwide'] ) ); // we'll override this later if the plugin can be included without fatal error
    9093
    91                 wp_redirect( self_admin_url("plugin-editor.php?file=$file&a=te&scrollto=$scrollto") );
    92                 exit;
     94                if ( wp_redirect( self_admin_url("plugin-editor.php?file=$file&a=te&scrollto=$scrollto") ) )
     95                        exit;
    9396        }
    9497
    9598        // List of allowable extensions
  • wp-admin/plugin-install.php

     
    1616        wp_die(__('You do not have sufficient permissions to install plugins on this site.'));
    1717
    1818if ( is_multisite() && ! is_network_admin() ) {
    19         wp_redirect( network_admin_url( 'plugin-install.php' ) );
    20         exit();
     19        if ( wp_redirect( network_admin_url( 'plugin-install.php' ) ) )
     20                exit();
    2121}
    2222
    2323$wp_list_table = _get_list_table('WP_Plugin_Install_List_Table');
  • wp-admin/plugins.php

     
    3131                                wp_die(__('You do not have sufficient permissions to activate plugins for this site.'));
    3232
    3333                        if ( is_multisite() && ! is_network_admin() && is_network_only_plugin( $plugin ) ) {
    34                                 wp_redirect( self_admin_url("plugins.php?plugin_status=$status&paged=$page&s=$s") );
     34                                if ( wp_redirect( self_admin_url("plugins.php?plugin_status=$status&paged=$page&s=$s") ) )
    3535                                exit;
    3636                        }
    3737
     
    4141                        if ( is_wp_error( $result ) ) {
    4242                                if ( 'unexpected_output' == $result->get_error_code() ) {
    4343                                        $redirect = self_admin_url('plugins.php?error=true&charsout=' . strlen($result->get_error_data()) . '&plugin=' . $plugin . "&plugin_status=$status&paged=$page&s=$s");
    44                                         wp_redirect(add_query_arg('_error_nonce', wp_create_nonce('plugin-activation-error_' . $plugin), $redirect));
    45                                         exit;
     44                                        if ( wp_redirect( add_query_arg( '_error_nonce', wp_create_nonce( 'plugin-activation-error_' . $plugin ), $redirect ) ) )
     45                                                exit;
    4646                                } else {
    4747                                        wp_die($result);
    4848                                }
     
    5555                        }
    5656
    5757                        if ( isset($_GET['from']) && 'import' == $_GET['from'] ) {
    58                                 wp_redirect( self_admin_url("import.php?import=" . str_replace('-importer', '', dirname($plugin))) ); // overrides the ?error=true one above and redirects to the Imports page, stripping the -importer suffix
     58                                // overrides the ?error=true one above and redirects to the Imports page, stripping the -importer suffix
     59                                if ( wp_redirect( self_admin_url( "import.php?import=" . str_replace('-importer', '', dirname( $plugin ) ) ) ) )
     60                                        exit;
    5961                        } else {
    60                                 wp_redirect( self_admin_url("plugins.php?activate=true&plugin_status=$status&paged=$page&s=$s") ); // overrides the ?error=true one above
     62                                // overrides the ?error=true one above
     63                                if ( wp_redirect( self_admin_url("plugins.php?activate=true&plugin_status=$status&paged=$page&s=$s") ) )
     64                                        exit;
    6165                        }
    6266                        exit;
    6367                        break;
     
    8286                                }
    8387                        }
    8488
    85                         if ( empty($plugins) ) {
    86                                 wp_redirect( self_admin_url("plugins.php?plugin_status=$status&paged=$page&s=$s") );
    87                                 exit;
     89                        if ( empty( $plugins ) ) {
     90                                if ( wp_redirect( self_admin_url( "plugins.php?plugin_status=$status&paged=$page&s=$s" ) ) )
     91                                        exit;
    8892                        }
    8993
    9094                        activate_plugins($plugins, self_admin_url('plugins.php?error=true'), is_network_admin() );
     
    96100                                update_option( 'recently_activated', $recent );
    97101                        }
    98102
    99                         wp_redirect( self_admin_url("plugins.php?activate-multi=true&plugin_status=$status&paged=$page&s=$s") );
    100                         exit;
     103                        if ( wp_redirect( self_admin_url( "plugins.php?activate-multi=true&plugin_status=$status&paged=$page&s=$s" ) ) )
     104                                exit;
     105
    101106                        break;
    102107                case 'update-selected' :
    103108
     
    157162                        check_admin_referer('deactivate-plugin_' . $plugin);
    158163
    159164                        if ( ! is_network_admin() && is_plugin_active_for_network( $plugin ) ) {
    160                                 wp_redirect( self_admin_url("plugins.php?plugin_status=$status&paged=$page&s=$s") );
    161                                 exit;
     165                                if ( wp_redirect( self_admin_url( "plugins.php?plugin_status=$status&paged=$page&s=$s" ) ) )
     166                                        exit;
    162167                        }
    163168
    164169                        deactivate_plugins( $plugin, false, is_network_admin() );
    165170                        if ( ! is_network_admin() )
    166171                                update_option( 'recently_activated', array( $plugin => time() ) + (array) get_option( 'recently_activated' ) );
    167                         if ( headers_sent() )
     172                        if ( headers_sent() ) {
    168173                                echo "<meta http-equiv='refresh' content='" . esc_attr( "0;url=plugins.php?deactivate=true&plugin_status=$status&paged=$page&s=$s" ) . "' />";
    169                         else
    170                                 wp_redirect( self_admin_url("plugins.php?deactivate=true&plugin_status=$status&paged=$page&s=$s") );
    171                         exit;
     174                        } else {
     175                                if ( wp_redirect( self_admin_url( "plugins.php?deactivate=true&plugin_status=$status&paged=$page&s=$s" ) ) )
     176                                        exit;
     177                        }
    172178                        break;
    173179                case 'deactivate-selected':
    174180                        if ( ! current_user_can('activate_plugins') )
     
    184190                                $plugins = array_filter( $plugins, 'is_plugin_active' );
    185191                                $plugins = array_diff( $plugins, array_filter( $plugins, 'is_plugin_active_for_network' ) );
    186192                        }
    187                         if ( empty($plugins) ) {
    188                                 wp_redirect( self_admin_url("plugins.php?plugin_status=$status&paged=$page&s=$s") );
    189                                 exit;
     193                        if ( empty( $plugins ) ) {
     194                                if ( wp_redirect( self_admin_url( "plugins.php?plugin_status=$status&paged=$page&s=$s" ) ) )
     195                                        exit;
    190196                        }
    191197
    192198                        deactivate_plugins( $plugins, false, is_network_admin() );
     
    198204                                update_option( 'recently_activated', $deactivated + (array) get_option( 'recently_activated' ) );
    199205                        }
    200206
    201                         wp_redirect( self_admin_url("plugins.php?deactivate-multi=true&plugin_status=$status&paged=$page&s=$s") );
    202                         exit;
     207                        if ( wp_redirect( self_admin_url( "plugins.php?deactivate-multi=true&plugin_status=$status&paged=$page&s=$s" ) ) )
     208                                exit;
     209
    203210                        break;
    204211                case 'delete-selected':
    205212                        if ( ! current_user_can('delete_plugins') )
     
    210217                        //$_POST = from the plugin form; $_GET = from the FTP details screen.
    211218                        $plugins = isset( $_REQUEST['checked'] ) ? (array) $_REQUEST['checked'] : array();
    212219                        if ( empty( $plugins ) ) {
    213                                 wp_redirect( self_admin_url("plugins.php?plugin_status=$status&paged=$page&s=$s") );
    214                                 exit;
     220                                if ( wp_redirect( self_admin_url( "plugins.php?plugin_status=$status&paged=$page&s=$s" ) ) )
     221                                        exit;
    215222                        }
    216223
    217224                        $plugins = array_filter($plugins, 'is_plugin_inactive'); // Do not allow to delete Activated plugins.
    218225                        if ( empty( $plugins ) ) {
    219                                 wp_redirect( self_admin_url( "plugins.php?error=true&main=true&plugin_status=$status&paged=$page&s=$s" ) );
    220                                 exit;
     226                                if ( wp_redirect( self_admin_url( "plugins.php?error=true&main=true&plugin_status=$status&paged=$page&s=$s" ) ) )
     227                                        exit;
    221228                        }
    222229
    223230                        include(ABSPATH . 'wp-admin/update.php');
     
    318325                        $delete_result = delete_plugins($plugins);
    319326
    320327                        set_transient('plugins_delete_result_' . $user_ID, $delete_result); //Store the result in a cache rather than a URL param due to object type & length
    321                         wp_redirect( self_admin_url("plugins.php?deleted=true&plugin_status=$status&paged=$page&s=$s") );
    322                         exit;
     328
     329                        if ( wp_redirect( self_admin_url( "plugins.php?deleted=true&plugin_status=$status&paged=$page&s=$s" ) ) )
     330                                exit;
     331
    323332                        break;
    324333                case 'clear-recent-list':
    325334                        if ( ! is_network_admin() )
  • wp-admin/post-new.php

     
    2222        $parent_file = 'edit.php';
    2323        $submenu_file = 'post-new.php';
    2424} elseif ( 'attachment' == $post_type ) {
    25         wp_redirect( admin_url( 'media-new.php' ) );
    26         exit;
     25        if ( wp_redirect( admin_url( 'media-new.php' ) ) )
     26                exit;
    2727} else {
    2828        $submenu_file = "post-new.php?post_type=$post_type";
    2929        if ( isset( $post_type_object ) && $post_type_object->show_in_menu && $post_type_object->show_in_menu !== true ) {
  • wp-admin/post.php

     
    7272                $location = add_query_arg( 'message', 4, get_edit_post_link( $post_id, 'url' ) );
    7373        }
    7474
    75         wp_redirect( apply_filters( 'redirect_post_location', $location, $post_id ) );
    76         exit;
     75        if ( wp_redirect( apply_filters( 'redirect_post_location', $location, $post_id ) ) )
     76                exit;
    7777}
    7878
    7979if ( isset( $_POST['deletepost'] ) )
     
    128128case 'edit':
    129129        $editing = true;
    130130
    131         if ( empty( $post_id ) ) {
    132                 wp_redirect( admin_url('post.php') );
     131        if ( empty( $post_id ) && wp_redirect( admin_url('post.php') ) )
    133132                exit();
    134         }
    135133
    136134        if ( ! $post )
    137135                wp_die( __( 'You attempted to edit an item that doesn&#8217;t exist. Perhaps it was deleted?' ) );
     
    147145
    148146        if ( ! empty( $_GET['get-post-lock'] ) ) {
    149147                wp_set_post_lock( $post_id );
    150                 wp_redirect( get_edit_post_link( $post_id, 'url' ) );
    151                 exit();
     148                if ( wp_redirect( get_edit_post_link( $post_id, 'url' ) ) )
     149                        exit();
    152150        }
    153151
    154152        $post_type = $post->post_type;
     
    246244        if ( ! wp_trash_post( $post_id ) )
    247245                wp_die( __( 'Error in moving to Trash.' ) );
    248246
    249         wp_redirect( add_query_arg( array('trashed' => 1, 'ids' => $post_id), $sendback ) );
    250         exit();
     247        if ( wp_redirect( add_query_arg( array('trashed' => 1, 'ids' => $post_id), $sendback ) ) )
     248                exit();
     249
    251250        break;
    252251
    253252case 'untrash':
     
    265264        if ( ! wp_untrash_post( $post_id ) )
    266265                wp_die( __( 'Error in restoring from Trash.' ) );
    267266
    268         wp_redirect( add_query_arg('untrashed', 1, $sendback) );
    269         exit();
     267        if ( wp_redirect( add_query_arg('untrashed', 1, $sendback) ) )
     268                exit();
     269
    270270        break;
    271271
    272272case 'delete':
     
    291291                        wp_die( __( 'Error in deleting.' ) );
    292292        }
    293293
    294         wp_redirect( add_query_arg('deleted', 1, $sendback) );
    295         exit();
     294        if ( wp_redirect( add_query_arg('deleted', 1, $sendback) ) )
     295                exit();
     296
    296297        break;
    297298
    298299case 'preview':
     
    300301
    301302        $url = post_preview();
    302303
    303         wp_redirect($url);
    304         exit();
     304        if ( wp_redirect( $url ) )
     305                exit();
     306
    305307        break;
    306308
    307309default:
    308         wp_redirect( admin_url('edit.php') );
    309         exit();
     310        if ( wp_redirect( admin_url('edit.php') ) )
     311                exit();
     312
    310313        break;
    311314} // end switch
    312315include('./admin-footer.php');
  • wp-admin/revision.php

     
    7575if ( ! $redirect && empty( $post->post_type ) )
    7676        $redirect = 'edit.php';
    7777
    78 if ( ! empty( $redirect ) ) {
    79         wp_redirect( $redirect );
     78if ( ! empty( $redirect ) && wp_redirect( $redirect ) )
    8079        exit;
    81 }
    8280
    8381// This is so that the correct "Edit" menu item is selected.
    8482if ( ! empty( $post->post_type ) && 'post' != $post->post_type )
  • wp-admin/theme-editor.php

     
    1010require_once('./admin.php');
    1111
    1212if ( is_multisite() && ! is_network_admin() ) {
    13         wp_redirect( network_admin_url( 'theme-editor.php' ) );
    14         exit();
     13        if ( wp_redirect( network_admin_url( 'theme-editor.php' ) ) )
     14                exit();
    1515}
    1616
    1717if ( !current_user_can('edit_themes') )
     
    9090                        $theme->cache_delete();
    9191                }
    9292        }
    93         wp_redirect( $location );
    94         exit;
     93
     94        if ( wp_redirect( $location ) )
     95                exit;
    9596break;
    9697
    9798default:
  • wp-admin/theme-install.php

     
    1616        wp_die( __( 'You do not have sufficient permissions to install themes on this site.' ) );
    1717
    1818if ( is_multisite() && ! is_network_admin() ) {
    19         wp_redirect( network_admin_url( 'theme-install.php' ) );
    20         exit();
     19        if ( wp_redirect( network_admin_url( 'theme-install.php' ) ) )
     20                exit();
    2121}
    2222
    2323$wp_list_table = _get_list_table('WP_Theme_Install_List_Table');
  • wp-admin/themes.php

     
    2121                if ( ! $theme->exists() || ! $theme->is_allowed() )
    2222                        wp_die( __( 'Cheatin&#8217; uh?' ) );
    2323                switch_theme( $theme->get_stylesheet() );
    24                 wp_redirect( admin_url('themes.php?activated=true') );
    25                 exit;
     24                if ( wp_redirect( admin_url('themes.php?activated=true') ) )
     25                        exit;
    2626        } elseif ( 'delete' == $_GET['action'] ) {
    2727                check_admin_referer('delete-theme_' . $_GET['stylesheet']);
    2828                $theme = wp_get_theme( $_GET['stylesheet'] );
    2929                if ( !current_user_can('delete_themes') || ! $theme->exists() )
    3030                        wp_die( __( 'Cheatin&#8217; uh?' ) );
    3131                delete_theme($_GET['stylesheet']);
    32                 wp_redirect( admin_url('themes.php?deleted=true') );
    33                 exit;
     32                if ( wp_redirect( admin_url('themes.php?deleted=true') ) )
     33                        exit;
    3434        }
    3535}
    3636
  • wp-admin/update-core.php

     
    1414add_thickbox();
    1515
    1616if ( is_multisite() && ! is_network_admin() ) {
    17         wp_redirect( network_admin_url( 'update-core.php' ) );
    18         exit();
     17        if ( wp_redirect( network_admin_url( 'update-core.php' ) ) )
     18                exit();
    1919}
    2020
    2121if ( ! current_user_can( 'update_core' ) && ! current_user_can( 'update_themes' ) && ! current_user_can( 'update_plugins' ) )
     
    371371        if ( !$update )
    372372                return;
    373373        dismiss_core_update( $update );
    374         wp_redirect( wp_nonce_url('update-core.php?action=upgrade-core', 'upgrade-core') );
    375         exit;
     374        if ( wp_redirect( wp_nonce_url('update-core.php?action=upgrade-core', 'upgrade-core') ) )
     375                exit;
    376376}
    377377
    378378function do_undismiss_core_update() {
     
    382382        if ( !$update )
    383383                return;
    384384        undismiss_core_update( $version, $locale );
    385         wp_redirect( wp_nonce_url('update-core.php?action=upgrade-core', 'upgrade-core') );
    386         exit;
     385        if ( wp_redirect( wp_nonce_url('update-core.php?action=upgrade-core', 'upgrade-core') ) )
     386                exit;
    387387}
    388388
    389389function no_update_actions($actions) {
     
    495495        } elseif ( isset( $_POST['checked'] ) ) {
    496496                $plugins = (array) $_POST['checked'];
    497497        } else {
    498                 wp_redirect( admin_url('update-core.php') );
    499                 exit;
     498                if ( wp_redirect( admin_url('update-core.php') ) )
     499                        exit;
    500500        }
    501501
    502502        $url = 'update.php?action=update-selected&plugins=' . urlencode(implode(',', $plugins));
     
    524524        } elseif ( isset( $_POST['checked'] ) ) {
    525525                $themes = (array) $_POST['checked'];
    526526        } else {
    527                 wp_redirect( admin_url('update-core.php') );
    528                 exit;
     527                if ( wp_redirect( admin_url('update-core.php') ) )
     528                        exit;
    529529        }
    530530
    531531        $url = 'update.php?action=update-selected-themes&themes=' . urlencode(implode(',', $themes));
  • wp-admin/update.php

     
    7070
    7171                check_admin_referer('activate-plugin_' . $plugin);
    7272                if ( ! isset($_GET['failure']) && ! isset($_GET['success']) ) {
    73                         wp_redirect( admin_url('update.php?action=activate-plugin&failure=true&plugin=' . urlencode( $plugin ) . '&_wpnonce=' . $_GET['_wpnonce']) );
     73                        if ( wp_redirect( admin_url( 'update.php?action=activate-plugin&failure=true&plugin=' . urlencode( $plugin ) . '&_wpnonce=' . $_GET['_wpnonce']) ) )
     74                                die();
    7475                        activate_plugin( $plugin, '', ! empty( $_GET['networkwide'] ), true );
    75                         wp_redirect( admin_url('update.php?action=activate-plugin&success=true&plugin=' . urlencode( $plugin ) . '&_wpnonce=' . $_GET['_wpnonce']) );
    76                         die();
     76                        if ( wp_redirect( admin_url('update.php?action=activate-plugin&success=true&plugin=' . urlencode( $plugin ) . '&_wpnonce=' . $_GET['_wpnonce']) ) )
     77                                die();
    7778                }
    7879                iframe_header( __('Plugin Reactivation'), true );
    7980                if ( isset($_GET['success']) )
  • wp-admin/upload.php

     
    8787                                }
    8888
    8989                                $location = add_query_arg( array( 'attached' => $attached ) , $location );
    90                                 wp_redirect( $location );
    91                                 exit;
     90                                if ( wp_redirect( $location ) )
     91                                        exit;
    9292                        }
    9393                        break;
    9494                case 'trash':
     
    129129                        break;
    130130        }
    131131
    132         wp_redirect( $location );
    133         exit;
     132        if ( wp_redirect( $location ) )
     133                exit;
    134134} elseif ( ! empty( $_GET['_wp_http_referer'] ) ) {
    135          wp_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce' ), wp_unslash( $_SERVER['REQUEST_URI'] ) ) );
    136         exit;
     135        if ( wp_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce' ), wp_unslash( $_SERVER['REQUEST_URI'] ) ) ) )
     136                exit;
    137137}
    138138
    139139$wp_list_table->prepare_items();
  • wp-admin/user/admin.php

     
    1111
    1212require_once( dirname(dirname(__FILE__)) . '/admin.php');
    1313
    14 if ( ! is_multisite() ) {
    15         wp_redirect( admin_url() );
     14if ( ! is_multisite() && wp_redirect( admin_url() ) )
    1615        exit;
    17 }
    1816
    1917$redirect_user_admin_request = ( ( $current_blog->domain != $current_site->domain ) || ( $current_blog->path != $current_site->path ) );
    2018$redirect_user_admin_request = apply_filters( 'redirect_user_admin_request', $redirect_user_admin_request );
    21 if ( $redirect_user_admin_request ) {
    22         wp_redirect( user_admin_url() );
     19if ( $redirect_user_admin_request && wp_redirect( user_admin_url() ) )
    2320        exit;
    24 }
     21
    2522unset( $redirect_user_admin_request );
  • wp-admin/user-edit.php

     
    8989                        $wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->signups} SET user_email = %s WHERE user_login = %s", $user->user_email, $current_user->user_login ) );
    9090                wp_update_user( $user );
    9191                delete_option( $current_user->ID . '_new_email' );
    92                 wp_redirect( add_query_arg( array('updated' => 'true'), self_admin_url( 'profile.php' ) ) );
    93                 die();
     92                if ( wp_redirect( add_query_arg( array('updated' => 'true'), self_admin_url( 'profile.php' ) ) ) )
     93                        die();
    9494        }
    9595} elseif ( is_multisite() && IS_PROFILE_PAGE && !empty( $_GET['dismiss'] ) && $current_user->ID . '_new_email' == $_GET['dismiss'] ) {
    9696        delete_option( $current_user->ID . '_new_email' );
    97         wp_redirect( add_query_arg( array('updated' => 'true'), self_admin_url( 'profile.php' ) ) );
    98         die();
     97        if ( wp_redirect( add_query_arg( array('updated' => 'true'), self_admin_url( 'profile.php' ) ) ) )
     98                die();
    9999}
    100100
    101101switch ($action) {
     
    143143        $redirect = add_query_arg( 'updated', true, get_edit_user_link( $user_id ) );
    144144        if ( $wp_http_referer )
    145145                $redirect = add_query_arg('wp_http_referer', urlencode($wp_http_referer), $redirect);
    146         wp_redirect($redirect);
    147         exit;
     146        if ( wp_redirect( $redirect ) _
     147                exit;
    148148}
    149149
    150150default:
  • wp-admin/user-new.php

     
    4747                if ( is_super_admin() ) {
    4848                        $user_details = get_user_by('login', $_REQUEST[ 'email' ]);
    4949                } else {
    50                         wp_redirect( add_query_arg( array('update' => 'enter_email'), 'user-new.php' ) );
    51                         die();
     50                        if ( wp_redirect( add_query_arg( array('update' => 'enter_email'), 'user-new.php' ) ) )
     51                                die();
    5252                }
    5353        }
    5454
    55         if ( !$user_details ) {
    56                 wp_redirect( add_query_arg( array('update' => 'does_not_exist'), 'user-new.php' ) );
    57                 die();
     55        if ( ! $user_details ) {
     56                if ( wp_redirect( add_query_arg( array('update' => 'does_not_exist'), 'user-new.php' ) ) )
     57                        die();
    5858        }
    5959
    6060        if ( ! current_user_can('promote_user', $user_details->ID) )
     
    8989                        $redirect = add_query_arg( array('update' => 'add'), 'user-new.php' );
    9090                }
    9191        }
    92         wp_redirect( $redirect );
    93         die();
     92        if ( wp_redirect( $redirect ) )
     93                die();
    9494} elseif ( isset($_REQUEST['action']) && 'createuser' == $_REQUEST['action'] ) {
    9595        check_admin_referer( 'create-user', '_wpnonce_create-user' );
    9696
     
    107107                                $redirect = 'users.php?update=add&id=' . $user_id;
    108108                        else
    109109                                $redirect = add_query_arg( 'update', 'add', 'user-new.php' );
    110                         wp_redirect( $redirect );
    111                         die();
     110                        if ( wp_redirect( $redirect ) )
     111                                die();
    112112                }
    113113        } else {
    114114                // Adding a new user to this blog
     
    128128                        } else {
    129129                                $redirect = add_query_arg( array('update' => 'newuserconfirmation'), 'user-new.php' );
    130130                        }
    131                         wp_redirect( $redirect );
    132                         die();
     131                        if ( wp_redirect( $redirect ) )
     132                                die();
    133133                }
    134134        }
    135135}
  • wp-admin/users.php

     
    103103        if ( ! current_user_can( 'promote_users' ) )
    104104                wp_die( __( 'You can&#8217;t edit that user.' ) );
    105105
    106         if ( empty($_REQUEST['users']) ) {
    107                 wp_redirect($redirect);
     106        if ( empty($_REQUEST['users']) && wp_redirect( $redirect ) )
    108107                exit();
    109         }
    110108
    111109        $editable_roles = get_editable_roles();
    112110        if ( empty( $editable_roles[$_REQUEST['new_role']] ) )
     
    134132                $user->set_role($_REQUEST['new_role']);
    135133        }
    136134
    137         wp_redirect(add_query_arg('update', $update, $redirect));
    138         exit();
     135        if ( wp_redirect( add_query_arg( 'update', $update, $redirect ) ) )
     136                exit();
    139137
    140138break;
    141139
     
    145143
    146144        check_admin_referer('delete-users');
    147145
    148         if ( empty($_REQUEST['users']) ) {
    149                 wp_redirect($redirect);
     146        if ( empty($_REQUEST['users'] ) && wp_redirect( $redirect ) )
    150147                exit();
    151         }
    152148
    153149        $userids = array_map( 'intval', (array) $_REQUEST['users'] );
    154150
    155151        if ( empty( $_REQUEST['delete_option'] ) ) {
    156152                $url = self_admin_url( 'users.php?action=delete&users[]=' . implode( '&users[]=', $userids ) . '&error=true' );
    157153                $url = str_replace( '&amp;', '&', wp_nonce_url( $url, 'bulk-users' ) );
    158                 wp_redirect( $url );
    159                 exit;
     154                if ( wp_redirect( $url ) )
     155                        exit;
    160156        }
    161157
    162158        if ( ! current_user_can( 'delete_users' ) )
     
    185181        }
    186182
    187183        $redirect = add_query_arg( array('delete_count' => $delete_count, 'update' => $update), $redirect);
    188         wp_redirect($redirect);
    189         exit();
     184        if ( wp_redirect( $redirect ) )
     185                exit();
    190186
    191187break;
    192188
     
    197193        check_admin_referer('bulk-users');
    198194
    199195        if ( empty($_REQUEST['users']) && empty($_REQUEST['user']) ) {
    200                 wp_redirect($redirect);
    201                 exit();
     196                if ( wp_redirect( $redirect ) )
     197                        exit();
    202198        }
    203199
    204200        if ( ! current_user_can( 'delete_users' ) )
     
    266262        if ( ! is_multisite() )
    267263                wp_die( __( 'You can&#8217;t remove users.' ) );
    268264
    269         if ( empty($_REQUEST['users']) ) {
    270                 wp_redirect($redirect);
     265        if ( empty($_REQUEST['users']) && wp_redirect( $redirect ) )
    271266                exit;
    272         }
    273267
    274268        if ( ! current_user_can( 'remove_users' ) )
    275269                wp_die( __( 'You can&#8217;t remove users.' ) );
     
    291285        }
    292286
    293287        $redirect = add_query_arg( array('update' => $update), $redirect);
    294         wp_redirect($redirect);
    295         exit;
     288        if ( wp_redirect( $redirect ) )
     289                exit;
    296290
    297291break;
    298292
     
    304298                wp_die( __( 'You can&#8217;t remove users.' ) );
    305299
    306300        if ( empty($_REQUEST['users']) && empty($_REQUEST['user']) ) {
    307                 wp_redirect($redirect);
    308                 exit();
     301                if ( wp_redirect( $redirect ) )
     302                        exit();
    309303        }
    310304
    311305        if ( !current_user_can('remove_users') )
     
    356350
    357351default:
    358352
    359         if ( !empty($_GET['_wp_http_referer']) ) {
    360                 wp_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce'), wp_unslash( $_SERVER['REQUEST_URI'] ) ) );
    361                 exit;
     353        if ( ! empty($_GET['_wp_http_referer'] ) ) {
     354                if ( wp_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce'), wp_unslash( $_SERVER['REQUEST_URI'] ) ) ) )
     355                        exit;
    362356        }
    363357
    364358        $wp_list_table->prepare_items();
    365359        $total_pages = $wp_list_table->get_pagination_arg( 'total_pages' );
    366360        if ( $pagenum > $total_pages && $total_pages > 0 ) {
    367                 wp_redirect( add_query_arg( 'paged', $total_pages ) );
    368                 exit;
     361                if ( wp_redirect( add_query_arg( 'paged', $total_pages ) ) )
     362                        exit;
    369363        }
    370364
    371365        include('./admin-header.php');
  • wp-admin/widgets.php

     
    138138        // delete
    139139        if ( isset($_POST['removewidget']) && $_POST['removewidget'] ) {
    140140
    141                 if ( !in_array($widget_id, $sidebar, true) ) {
    142                         wp_redirect( admin_url('widgets.php?error=0') );
    143                         exit;
     141                if ( ! in_array( $widget_id, $sidebar, true ) ) {
     142                        if ( wp_redirect( admin_url( 'widgets.php?error=0' ) ) )
     143                                exit;
    144144                }
    145145
    146146                $sidebar = array_diff( $sidebar, array($widget_id) );
     
    172172        }
    173173
    174174        wp_set_sidebars_widgets($sidebars_widgets);
    175         wp_redirect( admin_url('widgets.php?message=0') );
    176         exit;
     175        if ( wp_redirect( admin_url( 'widgets.php?message=0' ) ) )
     176                exit;
    177177}
    178178
    179179// Output the widget form without js
  • wp-includes/canonical.php

     
    248248                                );
    249249                                if ( isset( $old_feed_files[ basename( $redirect['path'] ) ] ) ) {
    250250                                        $redirect_url = get_feed_link( $old_feed_files[ basename( $redirect['path'] ) ] );
    251                                         wp_redirect( $redirect_url, 301 );
    252                                         die();
     251                                        if ( wp_redirect( $redirect_url, 301 ) )
     252                                                die();
    253253                                }
    254254                        }
    255255
     
    285285                                $redirect_url = apply_filters( 'wp_signup_location', network_site_url( 'wp-signup.php' ) );
    286286                        else
    287287                                $redirect_url = site_url( 'wp-login.php?action=register' );
    288                         wp_redirect( $redirect_url, 301 );
    289                         die();
     288
     289                        if ( wp_redirect( $redirect_url, 301 ) )
     290                                die();
    290291                }
    291292        }
    292293
     
    426427
    427428        if ( $do_redirect ) {
    428429                // protect against chained redirects
    429                 if ( !redirect_canonical($redirect_url, false) ) {
    430                         wp_redirect($redirect_url, 301);
    431                         exit();
     430                if ( ! redirect_canonical( $redirect_url, false ) ) {
     431                        if ( wp_redirect( $redirect_url, 301 ) )
     432                                exit();
    432433                } else {
    433434                        // Debug
    434435                        // die("1: $redirect_url<br />2: " . redirect_canonical( $redirect_url, false ) );
     
    518519                site_url( 'admin', 'relative' ),
    519520        );
    520521        if ( in_array( untrailingslashit( $_SERVER['REQUEST_URI'] ), $admins ) ) {
    521                 wp_redirect( admin_url() );
    522                 exit;
     522                if ( wp_redirect( admin_url() ) )
     523                        exit;
    523524        }
    524525
    525526        $logins = array(
     
    528529                site_url( 'login', 'relative' ),
    529530        );
    530531        if ( in_array( untrailingslashit( $_SERVER['REQUEST_URI'] ), $logins ) ) {
    531                 wp_redirect( site_url( 'wp-login.php', 'login' ) );
    532                 exit;
     532                if ( wp_redirect( site_url( 'wp-login.php', 'login' ) ) )
     533                        exit;
    533534        }
    534535}
    535536
  • wp-includes/class-wp-customize-manager.php

     
    148148         */
    149149        function after_setup_theme() {
    150150                if ( ! $this->doing_ajax() && ! validate_current_theme() ) {
    151                         wp_redirect( 'themes.php?broken=true' );
    152                         exit;
     151                        if ( wp_redirect( 'themes.php?broken=true' ) )
     152                                exit;
    153153                }
    154154        }
    155155
  • wp-includes/cron.php

     
    230230                set_transient( 'doing_cron', $doing_wp_cron );
    231231
    232232                ob_start();
    233                 wp_redirect( add_query_arg( 'doing_wp_cron', $doing_wp_cron, wp_unslash( $_SERVER['REQUEST_URI'] ) ) );
     233                if ( wp_redirect( add_query_arg( 'doing_wp_cron', $doing_wp_cron, wp_unslash( $_SERVER['REQUEST_URI'] ) ) ) )
    234234                echo ' ';
    235235
    236236                // flush any buffers and send the headers
  • wp-includes/load.php

     
    431431                require( ABSPATH . WPINC . '/kses.php' );
    432432                require( ABSPATH . WPINC . '/pluggable.php' );
    433433                require( ABSPATH . WPINC . '/formatting.php' );
    434                 wp_redirect( $link );
    435                 die();
     434                if ( wp_redirect( $link ) )
     435                        die();
    436436        }
    437437}
    438438
  • wp-includes/ms-functions.php

     
    16161616        if ( is_main_site() && is_404() && defined( 'NOBLOGREDIRECT' ) && ( $destination = apply_filters( 'blog_redirect_404', NOBLOGREDIRECT ) ) ) {
    16171617                if ( $destination == '%siteurl%' )
    16181618                        $destination = network_home_url();
    1619                 wp_redirect( $destination );
    1620                 exit();
     1619                if ( wp_redirect( $destination ) )
     1620                        exit();
    16211621        }
    16221622}
    16231623
  • wp-includes/pluggable.php

     
    750750        // If https is required and request is http, redirect
    751751        if ( $secure && !is_ssl() && false !== strpos($_SERVER['REQUEST_URI'], 'wp-admin') ) {
    752752                if ( 0 === strpos( $_SERVER['REQUEST_URI'], 'http' ) ) {
    753                         wp_redirect( set_url_scheme( $_SERVER['REQUEST_URI'], 'https' ) );
    754                         exit();
     753                        if ( wp_redirect( set_url_scheme( $_SERVER['REQUEST_URI'], 'https' ) ) )
     754                                exit();
    755755                } else {
    756                         wp_redirect( 'https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );
    757                         exit();
     756                        if ( wp_redirect( 'https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] ) )
     757                                exit();
    758758                }
    759759        }
    760760
     
    769769                // If the user wants ssl but the session is not ssl, redirect.
    770770                if ( !$secure && get_user_option('use_ssl', $user_id) && false !== strpos($_SERVER['REQUEST_URI'], 'wp-admin') ) {
    771771                        if ( 0 === strpos( $_SERVER['REQUEST_URI'], 'http' ) ) {
    772                                 wp_redirect( set_url_scheme( $_SERVER['REQUEST_URI'], 'https' ) );
    773                                 exit();
     772                                if ( wp_redirect( set_url_scheme( $_SERVER['REQUEST_URI'], 'https' ) ) )
     773                                        exit();
    774774                        } else {
    775                                 wp_redirect( 'https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );
    776                                 exit();
     775                                if ( wp_redirect( 'https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] ) )
     776                                        exit();
    777777                        }
    778778                }
    779779
     
    787787
    788788        $login_url = wp_login_url($redirect, true);
    789789
    790         wp_redirect($login_url);
    791         exit();
     790        if ( wp_redirect( $login_url ) )
     791                exit();
    792792}
    793793endif;
    794794
  • wp-includes/query.php

     
    36503650                if ( !$link )
    36513651                        return;
    36523652
    3653                 wp_redirect( $link, 301 ); // Permanent redirect
    3654                 exit;
     3653                // Permanent redirect
     3654                if ( wp_redirect( $link, 301 ) )
     3655                        exit;
    36553656        endif;
    36563657}
    36573658
  • wp-login.php

     
    1414// Redirect to https login if forced to use SSL
    1515if ( force_ssl_admin() && ! is_ssl() ) {
    1616        if ( 0 === strpos($_SERVER['REQUEST_URI'], 'http') ) {
    17                 wp_redirect( set_url_scheme( $_SERVER['REQUEST_URI'], 'https' ) );
    18                 exit();
     17                if ( wp_redirect( set_url_scheme( $_SERVER['REQUEST_URI'], 'https' ) ) )
     18                        exit();
    1919        } else {
    20                 wp_redirect( 'https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );
    21                 exit();
     20                if ( wp_redirect( 'https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] ) )
     21                        exit();
    2222        }
    2323}
    2424
     
    476476        $user = check_password_reset_key($_GET['key'], $_GET['login']);
    477477
    478478        if ( is_wp_error($user) ) {
    479                 wp_redirect( site_url('wp-login.php?action=lostpassword&error=invalidkey') );
    480                 exit;
     479                if ( wp_redirect( site_url('wp-login.php?action=lostpassword&error=invalidkey') ) )
     480                        exit;
    481481        }
    482482
    483483        $errors = new WP_Error();
     
    533533case 'register' :
    534534        if ( is_multisite() ) {
    535535                // Multisite uses wp-signup.php
    536                 wp_redirect( apply_filters( 'wp_signup_location', network_site_url('wp-signup.php') ) );
    537                 exit;
     536                if ( wp_redirect( apply_filters( 'wp_signup_location', network_site_url('wp-signup.php') ) ) )
     537                        exit;
    538538        }
    539539
    540         if ( !get_option('users_can_register') ) {
    541                 wp_redirect( site_url('wp-login.php?registration=disabled') );
    542                 exit();
     540        if ( ! get_option( 'users_can_register' ) ) {
     541                if ( wp_redirect( site_url( 'wp-login.php?registration=disabled' ) ) )
     542                        exit();
    543543        }
    544544
    545545        $user_login = '';
     
    550550                $errors = register_new_user($user_login, $user_email);
    551551                if ( !is_wp_error($errors) ) {
    552552                        $redirect_to = !empty( $_POST['redirect_to'] ) ? $_POST['redirect_to'] : 'wp-login.php?checkemail=registered';
    553                         wp_safe_redirect( $redirect_to );
    554                         exit();
     553                        if ( wp_safe_redirect( $redirect_to ) )
     554                                exit();
    555555                }
    556556        }
    557557
  • wp-signup.php

     
    88require( './wp-blog-header.php' );
    99
    1010if ( is_array( get_site_option( 'illegal_names' )) && isset( $_GET[ 'new' ] ) && in_array( $_GET[ 'new' ], get_site_option( 'illegal_names' ) ) == true ) {
    11         wp_redirect( network_home_url() );
    12         die();
     11        if ( wp_redirect( network_home_url() ) )
     12                die();
    1313}
    1414
    1515/**
     
    2222}
    2323add_action( 'wp_head', 'do_signup_header' );
    2424
    25 if ( !is_multisite() ) {
    26         wp_redirect( site_url('wp-login.php?action=register') );
     25if ( ! is_multisite() && wp_redirect( site_url( 'wp-login.php?action=register' ) ) )
    2726        die();
    28 }
    2927
    30 if ( !is_main_site() ) {
    31         wp_redirect( network_site_url( 'wp-signup.php' ) );
     28if ( ! is_main_site() && wp_redirect( network_site_url( 'wp-signup.php' ) ) )
    3229        die();
    33 }
    3430
    3531// Fix for page title
    3632$wp_query->is_404 = false;
  • wp-trackback.php

     
    7575if ( !isset($tb_id) || !intval( $tb_id ) )
    7676        trackback_response(1, 'I really need an ID for this to work.');
    7777
    78 if (empty($title) && empty($tb_url) && empty($blog_name)) {
     78if ( empty( $title ) && empty( $tb_url ) && empty( $blog_name ) ) {
    7979        // If it doesn't look like a trackback at all...
    80         wp_redirect(get_permalink($tb_id));
    81         exit;
     80        if ( wp_redirect( get_permalink( $tb_id ) ) )
     81                exit;
    8282}
    8383
    8484if ( !empty($tb_url) && !empty($title) ) {