diff --git a/wp-admin/includes/template.php b/wp-admin/includes/template.php index 11b6096823..9dd889f528 100644 --- a/wp-admin/includes/template.php +++ b/wp-admin/includes/template.php @@ -78,6 +78,7 @@ function _cat_row( $category, $level, $name_override = false ) { $category = get_category( $category ); + $default_cat_id = (int) get_option( 'default_category' ); $pad = str_repeat( '— ', $level ); $name = ( $name_override ? $name_override : $pad . ' ' . $category->name ); $edit_link = "categories.php?action=edit&cat_ID=$category->term_id"; @@ -85,7 +86,8 @@ function _cat_row( $category, $level, $name_override = false ) { $edit = "name)) . "'>$name
"; $actions = array(); $actions['edit'] = '' . __('Edit') . ''; - $actions['delete'] = "term_id) . "' onclick=\"if ( confirm('" . js_escape(sprintf(__("You are about to delete this category '%s'\n 'Cancel' to stop, 'OK' to delete."), $name )) . "') ) { return true;}return false;\">" . __('Delete') . ""; + if ( $default_cat_id != $category->term_id ) + $actions['delete'] = "term_id) . "' onclick=\"if ( confirm('" . js_escape(sprintf(__("You are about to delete this category '%s'\n 'Cancel' to stop, 'OK' to delete."), $name )) . "') ) { return true;}return false;\">" . __('Delete') . ""; $action_count = count($actions); $i = 0; foreach ( $actions as $action => $link ) { @@ -103,7 +105,7 @@ function _cat_row( $category, $level, $name_override = false ) { $posts_count = ( $category->count > 0 ) ? "$category->count" : $category->count; $output = " "; - if ( absint(get_option( 'default_category' ) ) != $category->term_id ) { + if ( $default_cat_id != $category->term_id ) { $output .= ""; } else { $output .= " "; @@ -124,10 +126,22 @@ function link_cat_row( $category ) { if ( is_wp_error( $category ) ) return $category; + $default_cat_id = (int) get_option( 'default_link_category' ); $name = ( $name_override ? $name_override : $category->name ); + $edit_link = "link-category.php?action=edit&cat_ID=$category->term_id"; if ( current_user_can( 'manage_categories' ) ) { - $edit = "name)) . "'>$name"; - $default_cat_id = (int) get_option( 'default_link_category' ); + $edit = "name)) . "'>$name
"; + $actions = array(); + $actions['edit'] = '' . __('Edit') . ''; + if ( $default_cat_id != $category->term_id ) + $actions['delete'] = "term_id) . "' onclick=\"if ( confirm('" . js_escape(sprintf(__("You are about to delete this category '%s'\n 'Cancel' to stop, 'OK' to delete."), $name )) . "') ) { return true;}return false;\">" . __('Delete') . ""; + $action_count = count($actions); + $i = 0; + foreach ( $actions as $action => $link ) { + ++$i; + ( $i == $action_count ) ? $sep = '' : $sep = ' | '; + $edit .= "$link$sep"; + } } else { $edit = $name; }