Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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
add comment

1 Answer

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
1  
@1212w2 Please accept this answer if it solved your issue. –  Brian Fegter Sep 25 '12 at 17:16
add comment

Your Answer

 
discard

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.