I have a custom role in functions.php:
add_role('test_pilot', 'Test Pilot', array(
'read' => true,
'edit_posts' => true,
'delete_posts' => true,
));
// Give the custom role a new level
$test_pilot = get_role('test_pilot');
$test_pilot->add_cap('level_3');
...and on the front-end I'm trying to echo the delete post link:
<?php echo get_delete_post_link( get_the_ID() ); ?>
The problem is the link isn't actually being displayed when logged in as a user with the test pilot role.
If I am logged in as an administrator the link does display.
What am I doing wrong?
Try to replacing with below code: