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

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
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>
add_action('admin_notices', 'my_admin_notice');


share|improve this answer
+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

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.