Quote:
Originally Posted by Angry Jew Cat
Is there a way I can add a "delete post" right into the theme for when I'm logged in as an admin? So I can edit or delete on the fly while browsing my site? Just a quicklink to jump me right on to the edit screen for that post.
|
Code:
function wp_delete_post_link($link = 'Delete This', $before = '', $after = '')
{
global $post;
if ( $post->post_type == 'page' ) {
if ( !current_user_can( 'edit_page', $post->ID ) )
return;
} else {
if ( !current_user_can( 'edit_post', $post->ID ) )
return;
}
$link = "<a href='" . wp_nonce_url( get_bloginfo('url') . "/wp-admin/post.php?action=delete&post=" . $post->ID, 'delete-post_' . $post->ID) . "'>".$link."</a>";
echo $before . $link . $after;
}
Code:
<?php wp_delete_post_link('Delete This', '<p>', '</p>');?>
