X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/7688c6ba71852cd89123b62b2d57683535e4702a..a5227bf01edbe6660486c9f5c0f0ed7b7fea3130:/wp-admin/link-category.php diff --git a/wp-admin/link-category.php b/wp-admin/link-category.php index 42058928..caf73923 100644 --- a/wp-admin/link-category.php +++ b/wp-admin/link-category.php @@ -1,5 +1,16 @@ %s category: this is the default one"), $cat_name)); - wp_delete_term($cat_ID, 'link_category'); + wp_delete_term($cat_ID, 'link_category', array('default' => $default_cat_id)); - wp_redirect('edit-link-categories.php?message=2'); + $location = 'edit-link-categories.php'; + if ( $referer = wp_get_original_referer() ) { + if ( false !== strpos($referer, 'edit-link-categories.php') ) + $location = $referer; + } + + $location = add_query_arg('message', 2, $location); + + wp_redirect($location); exit; break; case 'edit': - $title = __('Categories'); + $title = __('Edit Category'); $parent_file = 'link-manager.php'; $submenu_file = 'edit-link-categories.php'; require_once ('admin-header.php'); $cat_ID = (int) $_GET['cat_ID']; $category = get_term_to_edit($cat_ID, 'link_category'); - include('edit-link-category-form.php'); - include('admin-footer.php'); + include('./edit-link-category-form.php'); + include('./admin-footer.php'); exit; break; @@ -59,11 +79,20 @@ case 'editedcat': if ( !current_user_can('manage_categories') ) wp_die(__('Cheatin’ uh?')); - if ( wp_update_term($cat_ID, 'link_category', $_POST) ) - wp_redirect('edit-link-categories.php?message=3'); + $location = 'edit-link-categories.php'; + if ( $referer = wp_get_original_referer() ) { + if ( false !== strpos($referer, 'edit-link-categories.php') ) + $location = $referer; + } + + $update = wp_update_term($cat_ID, 'link_category', $_POST); + + if ( $update && !is_wp_error($update) ) + $location = add_query_arg('message', 3, $location); else - wp_redirect('edit-link-categories.php?message=5'); + $location = add_query_arg('message', 5, $location); + wp_redirect($location); exit; break; }