In a network (multisite) set-up using p2 --- how to include a option for a logged in user to delete a post from their own blog from the front end ??? I haven't the remotest idea how to do this - but some of you might. Any ideas really welcome!!
In a network (multisite) set-up using p2 --- how to include a option for a logged in user to delete a post from their own blog from the front end ??? I haven't the remotest idea how to do this - but some of you might. Any ideas really welcome!!
Gone part of the way with help from a forum post at
http://wordpress.org/support/topic/delete-post-on-front-end?replies=8
Entering <?php if (current_user_can('edit_post', $post->ID)) echo "<a href='" . wp_nonce_url("/wp-admin/post.php?action=delete&post=$id", 'delete-post_' . $post->ID) . "'>Delete post</a>" ?>
in the p2 Theme entry.php
appears to go half the way but clicking the link "Delete Post" redirects to a "WordPress Failure Notice" “Are you sure you want to do this? Please try again” . Clicking “Please try again” takes me back to previous page (the page from where I tried to delete).
So no delete. Yet.
Any ideas how to complete this would really be appreciated.
think i found a solution at http://www.ryanpaul.ca/websites/useful-wordpress-stuff/
The code on that ryanpaul.ca site no longer works. same situation as valuser's 2nd comment above.
Spoke too soon - that code does work for regular posts and pages, but unfortunately doesn't work for custom post types.
Anyone know how to handle custom post types?
Figured out that the reason this isn't working for Custom Post Types has something to do with the nonce URL being generated incorrectly.
Also figured out that WP has a built in function to handle this, even with Custom Post Types.
See this thread: http://wordpress.org/support/topic/front-end-delete-post-with-custom-post-type
This topic has been closed to new replies.