Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save douglasanro/c0d6b0693b4ec267b2e0a44a058de1e0 to your computer and use it in GitHub Desktop.
Save douglasanro/c0d6b0693b4ec267b2e0a44a058de1e0 to your computer and use it in GitHub Desktop.
Create custom WordPress dashboard widget
<?php
/* ----------------------------------------------------------------------------
* Create custom WordPress dashboard widget
* ------------------------------------------------------------------------- */
function dashboard_widget_function() {
echo '
<h2>Custom Dashboard Widget</h2>
<p>Custom content here</p>
';
}
function add_dashboard_widgets() {
wp_add_dashboard_widget( 'custom_dashboard_widget', 'Custom Dashoard Widget', 'dashboard_widget_function' );
}
add_action( 'wp_dashboard_setup', 'add_dashboard_widgets' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment