Help Text for WordPress Admin

On this tutorial, i show you how to add custom metaboxes to the individual editing screens, which you can use to provide help text for your clients or users.

Adding a Help Metabox to the Post Editing Screen

< ?php add_meta_box( $id, $title, $callback, $post_type, $context, $priority, $callback_args ); ?>

Parameters are:
$id – the unique ID for the metabox.
$title – the title which will be displayed to users.
$callback – the callback function defining the contents of the metabox.
$post_type – the post type whose editing screen the metabox will appear in. Leave this blank to add the metaboxes to all post type editing screens, or specify which post type you want to target.
$context – where in the editing screen you want the metabox to appear – ‘normal’, ‘advanced’ or ‘side’. The default is ‘advanced’ which places the metabox in the main area of the screen.
$priority – within the context you’ve defined, the priority for this metabox (‘high’, ‘core’, ‘default’ or ‘low’). This is useful if you’re adding multiple metaboxes.
$callback_args – arguments to pass into your callback function (optional)

Adding a Metabox on the Right of the Editing Screen

// Add help text to right of screen in a metabox
function designgala_metabox_top_right(){
	add_meta_box( 'after-title-help', 'Help!', 'designgala_top_right_help_metabox_content', 'page', 'side', 'high' );
}
// callback function to populate metabox
function designgala_top_right_help_metabox_content() { ?>
    <p>Make sure you click 'Publish' below to publish a new page once you've added it, or 'Update' to save any changes.</p>
< ?php }
add_action( 'add_meta_boxes', 'designgala_metabox_top_right' );
?>

Summary

Adding help text to individual editing screens can be very useful for users who don’t want to keep returning to the dashboard to get help.

Leave a Reply

Your email address will not be published. Required fields are marked *