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.

wondered if anyone knew the most elegant way to insert some sort of warning message each time someone tries to create a new post, i.e. 'please remember what you publish is your own responsibility', that sort of thing.

I'm thinking I'd like to use the error or warning css wordpress uses if it can't find something or there's an error some place. I'd have thought calling it from the functions file would be best so it doesn't get overwritten each time I update but not really sure what to search to find the reference for it, any ideas?

share|improve this question
add comment

1 Answer 1

up vote 3 down vote accepted
function my_admin_notice(){
    global $pagenow;
    if ( $pagenow == 'post-new.php' || $pagenow == 'post.php') {
         echo '<div class="error">
             <p>This notice only appears on the add and edit post & page.</p>
         </div>';
    }
}
add_action('admin_notices', 'my_admin_notice');

http://codex.wordpress.org/Plugin_API/Action_Reference/admin_notices

share|improve this answer
2  
+1 - removing the == 'post.php' will mean the notice is only printed on new posts. This will also show a message for all post types - so you may want to use get_current_screen() to identify which post type is being viewed. –  Stephen Harris Jun 20 '12 at 15:31
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.