Looking for wordpress Answers? Try Ask4KnowledgeBase
Looking for wordpress Keywords? Try Ask4Keywords

WordPressAdmin Dashboard Widgets


Introduction

With an admin dashboard widget you are able to display any kind of information at the admin dashboard. You can make multiple widgets if you want. You can add the code to the functions.php of your theme or to your plugin.

Syntax

  • add_action($tag, $function_to_add, $priority, $accepted_args);
  • wp_add_dashboard_widget($widget_id, $widget_name, $callback, $control_callback, $callback_args);

Parameters

ParameterDetails
$tag(string required) Name of the action where $function_to_add is hooked
$function_to_add(callable required) Name of the function you want to call.
$priority(int optional) Place of the function call in all functions of action (default = 10)
$accepted_args(int optional) Number of parameters the function accepts (default = 1)
$widget_id(string required) Unique slug for your widget
$widget_name(string required) Name of your widget (displayed in the head)
$callback(callable required) Name of the function which displays die content of your widget
$control_callback(callable optional) Name of the function which handles the widget options forms
$callback_args(array optional) Parameters of the $control_callback function