Advertisement
Guest User

Untitled

a guest
Nov 27th, 2014
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. add_action('before_delete_post', function($id) {
  2. wp_die(0);
  3. });
  4.  
  5. function wpse_92155_before_delete_post() {
  6. wp_redirect(admin_url('edit.php'));
  7. exit();
  8. } // function wpse_92155_before_delete_post
  9. add_action('before_delete_post', 'wpse_92155_before_delete_post', 1);
  10.  
  11. add_action( 'admin_head-edit.php', 'hide_delete_css_wpse_92155' );
  12. add_filter( 'post_row_actions', 'hide_row_action_wpse_92155', 10, 2 );
  13. add_filter( 'page_row_actions', 'hide_row_action_wpse_92155', 10, 2 );
  14.  
  15. function hide_delete_css_wpse_92155()
  16. {
  17. if( isset( $_REQUEST['post_status'] ) && 'trash' == $_REQUEST['post_status'] )
  18. {
  19. echo "<style>
  20. .alignleft.actions:first-child, #delete_all {
  21. display: none;
  22. }
  23. </style>";
  24. }
  25. }
  26.  
  27. function hide_row_action_wpse_92155( $actions, $post )
  28. {
  29. if( isset( $_REQUEST['post_status'] ) && 'trash' == $_REQUEST['post_status'] )
  30. unset( $actions['delete'] );
  31.  
  32. return $actions;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement