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('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=delete&post=$id", 'delete-post_' . $post->ID); echo '"><strong>删除文章</strong></a>'; } ?>
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!