WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When writing a post, is it possible to write text that is only visible when editing a post (comments intended exclusively for me) and not visible when when viewing the blog?

share|improve this question

Yes, using WordPress shortcodes you can create a quick annotation shortcode.

add_shortcode( 'annotation', 'wpse47489_private_annotation' );

function wpse47489_private_annotation( $args, $content = '' ) {
    if ( !current_user_can( 'administrator' ) ) return '';
    return "<div class='hidden-annotation'>$content</div>";

This will return an empty string for anyone but administrators. You can always return an empty string '' though, these annotations will be visible when editing the post.

Use in the content like so:

Lorem ipsum!

[annotation]find better introductory paragraph[/annotation]

...dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

share|improve this answer
Thank you very much! – 1212w2 Mar 31 '12 at 10:21
@1212w2 Please accept this answer if it solved your issue. – Brian Fegter Sep 25 '12 at 17:16

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.