Add a dashboard meta box widget to WordPress admin

WordPress
// PHP

What it does

In this example we will add a simple meta box widget to the WordPress admin area called “WordPress Support”.

The Code

function guyPrimaveraAddDashMeta() {

    wp_add_dashboard_widget(
     'wordpress-support',                 // Widget slug.
     'WordPress Support',                 // Widget title.
     'guyPrimaveraAddDashMeta_function'   // The function to show the content.
    );
}
add_action( 'wp_dashboard_setup', 'guyPrimaveraAddDashMeta' );

function guyPrimaveraAddDashMeta_function() {

    echo "    
    <p class='about-description'>
        <h4>WordPress Support</h4>
        <ul>
            <li><a href='https://codex.wordpress.org/Main_Page' target='_blank'>WordPress Docs</a></li>
            <li><a href='https://wordpress.org/support/' target='_blank'>WordPress Forums</a></li>
        </ul>
    </p>";
}

How To Use It

Paste this snippet into your theme's functions.php or in a WordPress plugin.

Menu