Taxonomy: Add a "delete" button on term edit page.
Add a 'delete' link next to the update button on the term edit screen so you can delete a term while you are reviewing it's details. Props cklosows, bradt, ocean90, johnbillion, DrewAPicture, ryan, MatheusGimenez, maguiar. Fixes #9777. git-svn-id: https://develop.svn.wordpress.org/trunk@40655 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
89ef4c2123
commit
c21b828581
|
@ -874,7 +874,8 @@ hr {
|
|||
.submitbox .submitdelete,
|
||||
#media-items a.delete,
|
||||
#media-items a.delete-permanently,
|
||||
#nav-menu-footer .menu-delete {
|
||||
#nav-menu-footer .menu-delete,
|
||||
#delete-link a.delete {
|
||||
color: #a00;
|
||||
}
|
||||
|
||||
|
@ -890,7 +891,8 @@ span.required,
|
|||
.submitbox .submitdelete:hover,
|
||||
#media-items a.delete:hover,
|
||||
#media-items a.delete-permanently:hover,
|
||||
#nav-menu-footer .menu-delete:hover {
|
||||
#nav-menu-footer .menu-delete:hover,
|
||||
#delete-link a.delete:hover {
|
||||
color: #dc3232;
|
||||
border: none;
|
||||
}
|
||||
|
@ -911,6 +913,17 @@ span.required,
|
|||
line-height: 28px;
|
||||
}
|
||||
|
||||
#delete-link {
|
||||
line-height: 28px;
|
||||
vertical-align: middle;
|
||||
text-align: left;
|
||||
margin-left: 8px;
|
||||
}
|
||||
|
||||
#delete-link a {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
#publishing-action {
|
||||
text-align: right;
|
||||
float: right;
|
||||
|
|
|
@ -1092,6 +1092,17 @@ p.popular-tags a {
|
|||
text-decoration: underline;
|
||||
}
|
||||
|
||||
#edittag {
|
||||
max-width: 800px;
|
||||
}
|
||||
|
||||
.edit-tag-actions {
|
||||
margin-top: 20px;
|
||||
overflow: hidden;
|
||||
padding: 10px;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
/* Comments */
|
||||
|
||||
.comment-php .wp-editor-area {
|
||||
|
@ -1348,6 +1359,10 @@ table.links-table {
|
|||
}
|
||||
|
||||
@media screen and ( max-width: 782px ) {
|
||||
.wp-core-ui .edit-tag-actions .button-primary {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
#post-body-content {
|
||||
min-width: 0;
|
||||
}
|
||||
|
|
|
@ -254,9 +254,20 @@ if ( 'category' == $taxonomy ) {
|
|||
* @param string $taxonomy Current taxonomy slug.
|
||||
*/
|
||||
do_action( "{$taxonomy}_edit_form", $tag, $taxonomy );
|
||||
|
||||
submit_button( __('Update') );
|
||||
?>
|
||||
|
||||
<div class="edit-tag-actions">
|
||||
|
||||
<?php submit_button( __( 'Update' ), 'primary', null, false ); ?>
|
||||
|
||||
<?php if ( current_user_can( 'delete_term', $tag->term_id ) ) : ?>
|
||||
<span id="delete-link">
|
||||
<a class="delete" href="<?php echo admin_url( wp_nonce_url( "edit-tags.php?action=delete&taxonomy=$taxonomy&tag_ID=$tag->term_id", 'delete-tag_' . $tag->term_id ) ) ?>"'><?php _e( 'Delete' ); ?></a>
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -65,7 +65,6 @@ if ( ! $referer ) { // For POST requests.
|
|||
$referer = wp_unslash( $_SERVER['REQUEST_URI'] );
|
||||
}
|
||||
$referer = remove_query_arg( array( '_wp_http_referer', '_wpnonce', 'error', 'message', 'paged' ), $referer );
|
||||
|
||||
switch ( $wp_list_table->current_action() ) {
|
||||
|
||||
case 'add-tag':
|
||||
|
@ -107,6 +106,9 @@ case 'delete':
|
|||
|
||||
$location = add_query_arg( 'message', 2, $referer );
|
||||
|
||||
// When deleting a term, prevent the action from redirecting back to a term that no longer exists.
|
||||
$location = remove_query_arg( array( 'tag_ID', 'action' ), $location );
|
||||
|
||||
break;
|
||||
|
||||
case 'bulk-delete':
|
||||
|
|
|
@ -28,6 +28,17 @@ jQuery(document).ready(function($) {
|
|||
return false;
|
||||
});
|
||||
|
||||
$( '#edittag' ).on( 'click', '.delete', function( e ) {
|
||||
if ( 'undefined' === typeof showNotice ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
var response = showNotice.warn();
|
||||
if ( ! response ) {
|
||||
e.preventDefault();
|
||||
}
|
||||
});
|
||||
|
||||
$('#submit').click(function(){
|
||||
var form = $(this).parents('form');
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ get_current_screen()->set_screen_reader_content( array(
|
|||
'heading_pagination' => $tax->labels->items_list_navigation,
|
||||
'heading_list' => $tax->labels->items_list,
|
||||
) );
|
||||
|
||||
wp_enqueue_script( 'admin-tags' );
|
||||
require_once( ABSPATH . 'wp-admin/admin-header.php' );
|
||||
include( ABSPATH . 'wp-admin/edit-tag-form.php' );
|
||||
include( ABSPATH . 'wp-admin/admin-footer.php' );
|
||||
|
|
Loading…
Reference in New Issue