admin管理员组

文章数量:1122846

How do I delete or remove the word Delete Permanently in uploading files? I wanted to remove this permanently so that the users won't keep deleting files which are not supposed to delete.

I use this code:

.button-link.delete-attachment{display:none}

But the problem of this, if the user uses the inspect element, they can just change it to display:block to show the delete button. Using CSS is not an option.

Is there a function code here to remove this? Or where can I find the core file in wp-admin folder, so that I could delete the <div> element manually?

How do I delete or remove the word Delete Permanently in uploading files? I wanted to remove this permanently so that the users won't keep deleting files which are not supposed to delete.

I use this code:

.button-link.delete-attachment{display:none}

But the problem of this, if the user uses the inspect element, they can just change it to display:block to show the delete button. Using CSS is not an option.

Is there a function code here to remove this? Or where can I find the core file in wp-admin folder, so that I could delete the <div> element manually?

Share Improve this question edited Nov 21, 2015 at 23:26 Sven 3,6641 gold badge34 silver badges48 bronze badges asked Nov 21, 2015 at 17:53 user84044user84044
Add a comment  | 

1 Answer 1

Reset to default 0

This might do the trick!

css:

.media-sidebar .details .edit-attachment {
    display: none;
}
.media-sidebar .details .delete-attachment {
    display: none;
}

And this:

foreach( array( 'post.php', 'post-new.php' ) as $hook )
    add_action( "admin_print_styles-$hook", 'admin_styles_so_25894288');

function admin_styles_so_25894288() {
    global $typenow;
    if( 'post' !== $typenow )
        return;
    ?>
    <style>
        .media-sidebar .details .delete-attachment
        { 
            display: block; 
        }
        .media-sidebar .details .edit-attachment
        { 
            display: block; 
        }
    </style>
    <?php

}

本文标签: attachmentsRemoving delete permanently button in uploading files media