Publish post from front-end
-
Hello
I found this code that allows you to delete a post from the front end:
<?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</a>" ?>I’m pretty sure there would be a way to modify that so that you could also publish a post from the front end (more info below). I tried modifying the code but with no luck.
<?php if (current_user_can('edit_post', $post->ID)) echo "<a href='" . wp_nonce_url("/wp-admin/post.php?action=publish&post=$id", 'publish-post_' . $post->ID) . "'>Publish</a>" ?>What I’m trying to accomplish is a sort of “dashboard” page that I’m almost done with that’ll let me quickly skim through pending posts with the title and content and other information that visitors may have submitted (through a front-end post submission form). The delete post link works fine, but don’t know how to get the publish one working.
Any help would be greatly appreciated! Thanks!
The topic ‘Publish post from front-end’ is closed to new replies.