Make WordPress Core


Ignore:
Timestamp:
01/10/2009 02:34:04 PM (16 years ago)
Author:
azaozz
Message:

Redirect properly on categories listing page, props Viper007Bond, fixes #8837

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/categories.php

    r10049 r10344  
    2626        wp_die(__('Cheatin’ uh?'));
    2727
    28     if( wp_insert_category($_POST ) ) {
    29         wp_redirect('categories.php?message=1#addcat');
    30     } else {
    31         wp_redirect('categories.php?message=4#addcat');
    32     }
     28    if ( wp_insert_category($_POST ) )
     29        wp_safe_redirect( add_query_arg( 'message', 1, wp_get_referer() ) . '#addcat' );
     30    else
     31        wp_safe_redirect( add_query_arg( 'message', 4, wp_get_referer() ) . '#addcat' );
     32
    3333    exit;
    3434break;
     
    4444
    4545    // Don't delete the default cats.
    46     if ( $cat_ID == get_option('default_category') )
     46    if ( $cat_ID == get_option('default_category') )
    4747        wp_die(sprintf(__("Can&#8217;t delete the <strong>%s</strong> category: this is the default one"), $cat_name));
    4848
    4949    wp_delete_category($cat_ID);
    5050
    51     wp_redirect('categories.php?message=2');
     51    wp_safe_redirect( add_query_arg( 'message', 2, wp_get_referer() ) );
    5252    exit;
    5353
     
    7070    }
    7171
    72     $sendback = wp_get_referer();
    73 
    74     wp_redirect($sendback);
     72    wp_safe_redirect( wp_get_referer() );
    7573    exit();
    7674
Note: See TracChangeset for help on using the changeset viewer.