Answers for "How to Allow Users to Delete a Post From the Front-End"

PHP
0

How to Allow Users to Delete a Post From the Front-End

<?php
$url = get_bloginfo('url');
  if (current_user_can('edit_post', $post->ID)){
    echo '<a class="delete-post" href="';
    echo wp_nonce_url("$url/wp-admin/post.php?action=trash&post=$id", 'delete-post_' . $post->ID);
    echo '">Delete post</a>';
  }
?>
Posted by: Guest on August-14-2021

Code answers related to "How to Allow Users to Delete a Post From the Front-End"

Browse Popular Code Answers by Language