X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/177fd6fefd2e3d5a0ea6591c71d660cabdb3c1a4..a7152b1f4c81650e5ba96ef07f9aa9c0fbc7752b:/wp-admin/edit-link-categories.php diff --git a/wp-admin/edit-link-categories.php b/wp-admin/edit-link-categories.php index b8dfebcf..711121be 100644 --- a/wp-admin/edit-link-categories.php +++ b/wp-admin/edit-link-categories.php @@ -1,42 +1,62 @@ %s category: this is the default one"), $cat_name)); + foreach( $cats as $cat_ID ) { + $cat_ID = (int) $cat_ID; + // Don't delete the default cats. + if ( $cat_ID == $default_cat_id ) + wp_die( sprintf( __("Can’t delete the %s category: this is the default one"), get_term_field('name', $cat_ID, 'link_category') ) ); - wp_delete_term($cat_ID, 'link_category'); - } + wp_delete_term($cat_ID, 'link_category', array('default' => $default_cat_id)); + } - $location = 'edit-link-categories.php'; - if ( $referer = wp_get_referer() ) { - if ( false !== strpos($referer, 'edit-link-categories.php') ) - $location = $referer; - } + $location = 'edit-link-categories.php'; + if ( $referer = wp_get_referer() ) { + if ( false !== strpos($referer, 'edit-link-categories.php') ) + $location = $referer; + } - $location = add_query_arg('message', 6, $location); - wp_redirect($location); - exit(); -} elseif ( !empty($_GET['_wp_http_referer']) ) { - wp_redirect(remove_query_arg(array('_wp_http_referer', '_wpnonce'), stripslashes($_SERVER['REQUEST_URI']))); + $location = add_query_arg('message', 6, $location); + wp_redirect($location); + exit(); + } +} elseif ( ! empty($_GET['_wp_http_referer']) ) { + wp_redirect( remove_query_arg( array('_wp_http_referer', '_wpnonce'), stripslashes($_SERVER['REQUEST_URI']) ) ); exit; } $title = __('Link Categories'); -$parent_file = 'edit.php'; -wp_enqueue_script( 'admin-categories' ); -wp_enqueue_script('admin-forms'); +wp_enqueue_script('admin-categories'); +if ( current_user_can('manage_categories') ) + wp_enqueue_script('inline-edit-tax'); + +add_contextual_help($current_screen, '
' . __('You can create groups of links by using link categories. Link category names must be unique and link categories are separate from the categories you use for posts.') . '
' . + '' . __('You can delete link categories, but that action does not delete the links within the category. Instead, it moves them to the default link category.') . '
' . + '' . __('For more information:') . '
' . + '' . __('Link Categories Documentation') . '
' . + '' . __('Support Forums') . '
' +); require_once ('admin-header.php'); @@ -45,41 +65,48 @@ $messages[2] = __('Category deleted.'); $messages[3] = __('Category updated.'); $messages[4] = __('Category not added.'); $messages[5] = __('Category not updated.'); -$messages[6] = __('Categories deleted.'); +$messages[6] = __('Categories deleted.'); ?> -if (isset($_GET['message'])) : ?> -