Press "Enter" to skip to content

Quick Tip: Add help text above the Publish button

True to my quick tips series, this is a new quick tip! How to add help text above the Publish button on the WordPress admin.

This is a straightforward function. Maybe you want to add a reminder for users before they publish? Maybe you even want to prevent them from publishing based on post meta? If the latter sounds like what you want, then I have a tutorial that can help: How to intercept post publishing based on post meta

If you’re here just to add text above the Publish button, that’s cool too. The snippet is listed below the cut.

add_action( 'post_submitbox_misc_actions', 'add_help_text_to_publish', 10, 2 );

function add_help_text_to_publish( $post_obj ) {
	//post or whatever custom post type you'd like to add the text
	if ( 'post' === $post_obj->post_type ) {
		echo '<p style="padding-left: 15px;"><strong>Note:</strong> Some helpful text here.</p>';
	}
}

This function is using the post_submitbox_misc_actions hook that fires after the post time/date setting in the WordPress Publish meta box. This metabox is the same box where the “Publish/Update” button normally resides.

You can drop this snippet in your functions.php file if there’s nowhere else that makes sense in your WordPress theme. A gentle reminder, if you’re using a theme that you didn’t make yourself and that theme will have updates in the future, add your changes in a child theme. If it is a theme you’ve created yourself, it’s good practice to customize any back-end functionality via a plugin.

This is what that snippet of code I posted earlier would look like on the WordPress admin.

And that’s it! Quickest quick tip ever. Drop a comment below if there are any questions. Hope this helps someone.

One Comment

  1. brucekaiser
    brucekaiser August 16, 2020

    Thanks for the tip I was using this to add some fields and it worked for a long time. Since WP5.0 I think this has stopped working. Can you tell us how to achieve this in the new editor?

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.