Skip to content

Instantly share code, notes, and snippets.

@elvismdev
Created January 11, 2018 21:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elvismdev/c801f0cf15d237dafd159c7f27769422 to your computer and use it in GitHub Desktop.
Save elvismdev/c801f0cf15d237dafd159c7f27769422 to your computer and use it in GitHub Desktop.
JS alert/confirmation pop-up before permanently erase all content items in the WordPress trash.
<?php
function trash_empty_confirmation() { ?>
<script type="text/javascript">
(function($) {
$('[id=delete_all]').click(function(e){
return confirm( "Are you sure you want to permanently erase all content items in the Trash ?" );
});
})( jQuery );
</script>
<?php }
add_action( 'admin_footer-edit.php', 'trash_empty_confirmation' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment