Title: Delete custom post
Last modified: April 17, 2023

---

# Delete custom post

 *  Resolved [Alex](https://wordpress.org/support/users/alexblack369/)
 * (@alexblack369)
 * [3 years ago](https://wordpress.org/support/topic/delete-custom-post/)
 * Hi, I’m interested in your plugin (pro version), but I have a question first:
   can user somehow delete created custom post? I mean, can I put a button at the
   end of a custom post which can be used for post deletion from the front-end?

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Author [Phil Kurth](https://wordpress.org/support/users/philkurth/)
 * (@philkurth)
 * [3 years ago](https://wordpress.org/support/topic/delete-custom-post/#post-16664073)
 * Hi [@alexblack369](https://wordpress.org/support/users/alexblack369/),
 * The plugin only offers the ability to create and edit posts. To delete them, 
   I suggest using WordPress’ [get_delete_post_link() function](https://developer.wordpress.org/reference/functions/get_delete_post_link/)
   wherever you need it to create delete post links/buttons.
 * Cheers,
   Phil
 *  Thread Starter [Alex](https://wordpress.org/support/users/alexblack369/)
 * (@alexblack369)
 * [3 years ago](https://wordpress.org/support/topic/delete-custom-post/#post-16665172)
 * Hi [@philkurth](https://wordpress.org/support/users/philkurth/), thank you for
   the quick answer.
 * I’m not proficient in the back end development, so can you help me with some 
   code example which will work with your plugin? Maybe some advice where to put
   that code?
 * I’m sure that your answer will help the others like me who wants to use Advanced
   Forms for ACF, but also need an credible advice on how to delete a post from 
   the front end.
 *  Plugin Author [Phil Kurth](https://wordpress.org/support/users/philkurth/)
 * (@philkurth)
 * [2 years, 11 months ago](https://wordpress.org/support/topic/delete-custom-post/#post-16743356)
 * Hi [@alexblack369](https://wordpress.org/support/users/alexblack369/),
 * So sorry for the slow reply – I actually miss the response notification to this
   one. You’ve probably work this out by now but here is an example snippet of how
   you might use the function to offer delete post links in a WordPress loop. Note
   that this snippet checks whether or not the current user has permission to delete
   the post:
 *     ```wp-block-code
       <?php
           if ( have_posts() ) {
               while ( have_posts() ) {
                   the_post();
                   ?>
                   <h2><?php the_title(); ?></h2>
                   <div><?php the_content(); ?></div>
   
                   <?php
                   // Check if the current user can delete the post
                   if (current_user_can('delete_post', get_the_ID())) {
                       $del_link = get_delete_post_link( get_the_ID() );
                       echo '<a href="' . $del_link . '">Delete Post</a>';
                   }
                   ?>
                   <hr>
                   <?php
               }
           }
       ?>
       ```
   

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Delete custom post’ is closed to new replies.

 * ![](https://ps.w.org/advanced-forms/assets/icon-256x256.png?rev=1894254)
 * [Advanced Forms for ACF](https://wordpress.org/plugins/advanced-forms/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/advanced-forms/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/advanced-forms/)
 * [Active Topics](https://wordpress.org/support/plugin/advanced-forms/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/advanced-forms/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/advanced-forms/reviews/)

## Tags

 * [delete](https://wordpress.org/support/topic-tag/delete/)
 * [delete post](https://wordpress.org/support/topic-tag/delete-post/)
 * [post](https://wordpress.org/support/topic-tag/post/)

 * 3 replies
 * 2 participants
 * Last reply from: [Phil Kurth](https://wordpress.org/support/users/philkurth/)
 * Last activity: [2 years, 11 months ago](https://wordpress.org/support/topic/delete-custom-post/#post-16743356)
 * Status: resolved