How To Add Private Notes In WordPress Blog Posts?

Posted by

Hi,

Many wordpress users wants to leave private notes on specific posts on their blog which can be only visible by blog admin. In order to do that you need to add this code in functions.php file of your blog:

add_shortcode( ‘note’, ‘sc_note’ );

function sc_note( $atts, $content = null ) {
if ( current_user_can( ‘publish_posts’ ) )
return ‘<div>’.$content.'</div>’;
return ”;
}

Now, add this code in the post for which you need to leave the private notes:

[note]
This is a personal note which has added by the blog admin!
[/note]

That’s it!

Thanks,

Shane G.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.