wp_ajax_dashboard_widgets() WordPress Function
The wp_ajax_dashboard_widgets() function is used to update the order of the dashboard widgets via AJAX. It takes two arguments: the new order of the widgets, and a list of the widget IDs. The function then updates the usermeta for the current user, and return a JSON encoded string containing the new order of the widgets.
wp_ajax_dashboard_widgets() #
Ajax handler for dashboard widgets.
Source
File: wp-admin/includes/ajax-actions.php
function wp_ajax_dashboard_widgets() {
require_once ABSPATH . 'wp-admin/includes/dashboard.php';
$pagenow = $_GET['pagenow'];
if ( 'dashboard-user' === $pagenow || 'dashboard-network' === $pagenow || 'dashboard' === $pagenow ) {
set_current_screen( $pagenow );
}
switch ( $_GET['widget'] ) {
case 'dashboard_primary':
wp_dashboard_primary();
break;
}
wp_die();
}
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
| Version | Description |
|---|---|
| 3.4.0 | Introduced. |