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();
}


Top ↑

Changelog

Changelog
VersionDescription
3.4.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.

Show More