Add private notes to WordPress posts

May 15, 2009 · Print This Article

Sometimes, you may need to leave a private note (e.g. only visible to admin) to a post, but there’s no built-in solution in WordPress to do it.

Here’s the code you need to add to your functions.php file:

add_shortcode( 'note', 'live_note' );

function live_note( $atts, $content = null ) {
if ( current_user_can( 'publish_posts' ) )
return '<div class="note">'.$content.'</div>';
return '';
}

Once done, simply add the following shortcode in your posts:

[note]
This is a note that only someone can see...
[/note]

Note that the note will be displayed with a <div class=”note”></div> tags, so you can use it to give a specific style to your notes.


Your choice for site templates and wordpress themes

Comments

One Response to “Add private notes to WordPress posts”

  1. Tim Noonan’s Favourite and blind friendly Accessible WordPress Plugins and his Choice of Thesis as Theme. Screen-reader Friendly blog widgets — Vocal Branding Australia on April 9th, 2010 1:26 pm

    […] The instructions on how to do this are here My Favourite Accessible Plugins […]

Got something to say?

You must be logged in to post a comment.