DISCLAIMER: this post is older than one year and may not be up to date with latest WordPress version.

Sometimes, you may need to leave a private note (Only visible to admins) to a post, but there’s no built-in solution in WordPress to do it. So, here’s a nice hack I use on my blogs.

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

add_shortcode( 'note', 'sc_note' );

function sc_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:

This is a personal note that only admins can see!

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!

One Comment

  1. Thanks for this! I’ve been wanting to do this for awhile as I collect links, resources, thoughts, forum posts, context, etc and would like to keep them with the post. I wrapped your there in a WP plugin called “Private Notes” which is published at http://wordpress.org/extend/plugins/private-notes/

Leave a Comment

Your email address will not be published. Required fields are marked *