Home >CMS Tutorial >WordPress >How to delete articles in wordpress frontend

How to delete articles in wordpress frontend

尚
Original
2019-07-13 13:12:562633browse

How to delete articles in wordpress frontend

The function of deleting articles directly on the front desk of the website is realized through a php function. It is estimated that there are very few people who need this function;

Because a local one is built Collection station, if you want to delete the articles you have read with one click, you can improve the work effect;

Put the following function into the custom position of single.php article content page, so that when you click on the article in the front browser Deleting it will quickly achieve what we want;

<?php   
$url = get_bloginfo(&#39;url&#39;);   
  if (current_user_can(&#39;edit_post&#39;, $post->ID)){   
    echo &#39;<a class="delete-post" href="&#39;;
    echo wp_nonce_url("$url/wp-admin/post.php?action=delete&post=$id", &#39;delete-post_&#39; . $post->ID);  
    echo &#39;"><strong>删除文章</strong></a>&#39;;   
  }   
?>

For more wordpress related technical articles, please visit the wordpress tutorial column to learn!

The above is the detailed content of How to delete articles in wordpress frontend. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn