Guest User

Untitled

a guest
Jun 22nd, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. function wp_delete_post_link($link = 'Delete This', $before = '', $after = '', $title="Move this item to the Trash", $cssClass="delete-post") {
  2. global $post;
  3. if ( $post->post_type == 'page' ) {
  4. if ( !current_user_can( 'edit_page' ) )
  5. return;
  6. } else {
  7. if ( !current_user_can( 'edit_post' ) )
  8. return;
  9. }
  10. $delLink = wp_nonce_url( site_url() . "/wp-admin/post.php?action=trash&post=" . $post->ID, 'trash-' . $post->post_type . '_' . $post->ID);
  11. $link = '<a class="' . $cssClass . '" href="' . $delLink . '" onclick="javascript:if(!confirm('Are you sure you want to move this item to trash?')) return false;" title="'.$title.'" />'.$link."</a>";
  12. return $before . $link . $after;
  13. }
Add Comment
Please, Sign In to add comment