WPDev.one
Core Function
View Source on Trac ↗

wp_add_dashboard_widget()

wp_add_dashboard_widget( mixed $widget_id, mixed $widget_name, mixed $callback, mixed $control_callback = null, mixed $callback_args = null, mixed $context = 'normal', mixed $priority = 'core' )

Adds a new dashboard widget.

Parameters 6 required

Name / Type Description
$widget_id
string

Widget ID (used in the 'id' attribute for the widget).

Required
$widget_name
string

Title of the widget.

Required
callable

$callback Function that fills the widget with the desired content. The function should echo its output.

Required
$control_callback
callable

Optional. Function that outputs controls for the widget. Default null.

array

$callback_args Optional. Data that should be set as the $args property of the widget array (which is the second parameter passed to your callback). Default null.

Required
string

$context Optional. The context within the screen where the box should display. Accepts 'normal', 'side', 'column3', or 'column4'. Default 'normal'.

Required
string

$priority Optional. The priority within the context where the box should show. Accepts 'high', 'core', 'default', or 'low'. Default 'core'.

Required

Return Value

(void)
No return value description available.

Function Information

Since Version
2.7.0
Source File
wp-admin/includes/dashboard.php
Advertisement