The admin bar is a featured introduced by WordPress 3.1. It adds useful options such as adding new posts or editing an existing one.
But it do not feature a delete button, so you can’t trash a post without accessing the post lists on the dashboard.
Here is a cool hack to add a “delete” button to WordPress admin bar.
add_action( 'admin_bar_menu', 'crunchify_add_adminbar_trash_menu', 35 ); function crunchify_add_adminbar_trash_menu() { if ( ! is_super_admin() || ! is_admin_bar_showing() ) return; $current_object = get_queried_object(); // check, is the objekt with the value readable if ( ! isset( $current_object->post_author ) ) return; // check, if the user id the same as the author-id if the current post if ( (int) $current_object->post_author !== (int) get_current_user_id() ) return; if ( empty( $current_object ) ) return; if ( ! empty( $current_object->post_type ) && ( $post_type_object = get_post_type_object( $current_object->post_type ) ) && current_user_can( $post_type_object->cap->edit_post, $current_object->ID ) ) { global $wp_admin_bar; $wp_admin_bar->add_menu( array( 'id' => 'delete', 'title' => __( 'Move to Trash' ), 'href' => get_delete_post_link( $current_object->term_id ) ) ); } }
Please let us know if you face any issue running this code.