Forums

'delete post' on front end, but only for specific category? (2 posts)

  1. popart
    Member
    Posted 3 years ago #

    I'm using this code to delete posts on the front end. (Only logged-in admin can see the Delete Post link on the blog page.)

    But, I'd like to also wrap this code in an IF/THEN so that it only shows up for certain categories. I'm not a PHP programmer. Can any one suggest how to do it? Thanks.

    Here's the code: (in the loop of index.php in my theme)

    <?php if (current_user_can('edit_post', $post->ID)) echo "<a href='" . wp_nonce_url("/wp-admin/post.php?action=delete&amp;post=$id", 'delete-post_' . $post->ID) . "'>Delete post</a>" ?>

    Found it here: http://wordpress.org/support/topic/118769

  2. irishbloke
    Member
    Posted 3 years ago #

    Just posting to say thanks for that code was just waht i was looking for.

Topic Closed

This topic has been closed to new replies.

About this Topic