Add a custom dashboard widget

// Add a new widget to the dashboard using a custom function
function wpmudev_add_dashboard_widgets() {
	wp_add_dashboard_widget(
		'wpmudev_dashboard_widget', // Widget slug
		'My Custom Dashboard Widget', // Widget title
		'wpmudev_new_dashboard_widget_function' // Function name to display the widget
	);
}
// Register the new dashboard widget with the 'wp_dashboard_setup' action
add_action( 'wp_dashboard_setup', 'wpmudev_add_dashboard_widgets' );

// Initialize the function to output the contents of your new dashboard widget
function wpmudev_new_dashboard_widget_function() {
	echo "Hello from WPMU DEV. The world is your oyster and I'm the pearl! Edit me with HTML or PHP to create the widget of your dreams. ";
}

Leave a Reply

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

Do NOT follow this link or you will be banned from the site!
%d bloggers like this: