With the filter we prevent the Trash
link from being printed.
And with the action, redirect back to the post listing page if the user tries to access the URL directly (/wp-admin/edit.php?post_status=trash&post_type=post
).
add_filter( 'views_edit-post', 'wpse_74488_remove_trash_link' );
add_action( 'admin_head-edit.php', 'wpse_74488_block_trash_access' );
function wpse_74488_remove_trash_link( $views )
{
if( !current_user_can( 'delete_plugins' ) )
unset( $views['trash'] );
return $views;
}
function wpse_74488_block_trash_access()
{
global $current_screen;
if(
'post' != $current_screen->post_type
|| 'trash' != $_GET['post_status']
)
return;
if( !current_user_can( 'delete_plugins' ) )
{
wp_redirect( admin_url() . 'edit.php' );
exit;
}
}