Index: src/wp-admin/css/list-tables.css
===================================================================
--- src/wp-admin/css/list-tables.css (revision 28256)
+++ src/wp-admin/css/list-tables.css (working copy)
@@ -715,6 +715,10 @@
padding: 2px 0 0;
}
+.row-actions a {
+ white-space: nowrap;
+}
+
tr:hover .row-actions,
.mobile .row-actions,
.row-actions.visible,
Index: src/wp-admin/edit-tags.php
===================================================================
--- src/wp-admin/edit-tags.php (revision 28256)
+++ src/wp-admin/edit-tags.php (working copy)
@@ -65,6 +65,41 @@
exit;
break;
+case 'default':
+ $tag_ID = (int) $_REQUEST['tag_ID'];
+ check_admin_referer( 'default-tag_' . $tag_ID );
+
+ if ( !current_user_can( 'manage_options' ) ) {
+ wp_die( __( 'Cheatin’ uh?' ) );
+ }
+
+ $location = 'edit-tags.php?taxonomy=' . $taxonomy;
+
+ if ( !isset( $_REQUEST['tag_ID'] ) ) {
+ wp_redirect( $location );
+ exit;
+ }
+
+ $tag_ID = (int) $_REQUEST['tag_ID'];
+
+ if ( !term_exists( $tag_ID, $taxonomy ) ) {
+ wp_redirect( $location );
+ exit;
+ }
+
+ update_option( 'default_' . $taxonomy, $tag_ID );
+
+ if ( ! empty( $_REQUEST['paged'] ) ) {
+ $location = add_query_arg( 'paged', (int) $_REQUEST['paged'], $location );
+ }
+
+ $location = add_query_arg( 'message', 7, $location );
+
+ wp_redirect( $location );
+ exit;
+
+break;
+
case 'delete':
$location = 'edit-tags.php?taxonomy=' . $taxonomy;
if ( 'post' != $post_type )
@@ -260,7 +295,8 @@
3 => __( 'Item updated.' ),
4 => __( 'Item not added.' ),
5 => __( 'Item not updated.' ),
- 6 => __( 'Items deleted.' )
+ 6 => __( 'Items deleted.' ),
+ 7 => __( 'Item set as default.')
);
$messages['category'] = array(
0 => '', // Unused. Messages start at index 1.
@@ -269,7 +305,8 @@
3 => __( 'Category updated.' ),
4 => __( 'Category not added.' ),
5 => __( 'Category not updated.' ),
- 6 => __( 'Categories deleted.' )
+ 6 => __( 'Categories deleted.' ),
+ 7 => __( 'Category set as default.')
);
$messages['post_tag'] = array(
0 => '', // Unused. Messages start at index 1.
@@ -278,7 +315,8 @@
3 => __( 'Tag updated.' ),
4 => __( 'Tag not added.' ),
5 => __( 'Tag not updated.' ),
- 6 => __( 'Tags deleted.' )
+ 6 => __( 'Tags deleted.' ),
+ 7 => __( 'Tag set as default.')
);
/**
Index: src/wp-admin/includes/class-wp-terms-list-table.php
===================================================================
--- src/wp-admin/includes/class-wp-terms-list-table.php (revision 28256)
+++ src/wp-admin/includes/class-wp-terms-list-table.php (working copy)
@@ -268,6 +268,18 @@
$default_term = get_option( 'default_' . $taxonomy );
+ $default_term_label = '';
+ if ( $tag->term_id == $default_term ) {
+ $default_term_label = ' - ' . __( 'Default' ) . '';
+ }
+ $default_link_args = array(
+ 'action' => 'default',
+ 'taxonomy' => $taxonomy,
+ 'tag_ID' => $tag->term_id,
+ 'paged' => $this->get_pagenum(),
+ );
+ $default_link = wp_nonce_url( add_query_arg( $default_link_args, admin_url( 'edit-tags.php' ) ), 'default-tag_' . $tag->term_id );
+
$pad = str_repeat( '— ', max( 0, $this->level ) );
/**
@@ -288,13 +300,21 @@
$qe_data = get_term( $tag->term_id, $taxonomy, OBJECT, 'edit' );
$edit_link = esc_url( get_edit_term_link( $tag->term_id, $taxonomy, $this->screen->post_type ) );
- $out = '' . $name . '
';
+ $default_categories = array(
+ 'category',
+ 'link_category'
+ );
+
+ $out = '' . $name . '' . $default_term_label . '
';
$actions = array();
if ( current_user_can( $tax->cap->edit_terms ) ) {
$actions['edit'] = '' . __( 'Edit' ) . '';
- $actions['inline hide-if-no-js'] = '' . __( 'Quick Edit' ) . '';
+ $actions['inline hide-if-no-js'] = '' . __( 'Quick Edit' ) . '';
}
+ if ( current_user_can( 'manage_options' ) && $tag->term_id != $default_term && ( in_array( $taxonomy, $default_categories ) ) ) {
+ $actions['default'] = '' . __( 'Set as Default' ) . '';
+ }
if ( current_user_can( $tax->cap->delete_terms ) && $tag->term_id != $default_term )
$actions['delete'] = "term_id ) . "'>" . __( 'Delete' ) . "";
if ( $tax->public )
Index: src/wp-admin/options-writing.php
===================================================================
--- src/wp-admin/options-writing.php (revision 28256)
+++ src/wp-admin/options-writing.php (working copy)
@@ -71,15 +71,7 @@
-