Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: wp_dashboard_widgets

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

Line Code
134      $dashboard_widgets = array();
135      $dashboard_widgets[] = 'dashboard_recent_comments';
136      $dashboard_widgets[] = 'dashboard_incoming_links';
137      $dashboard_widgets[] = 'dashboard_primary';
138      if ( current_user_can( 'activate_plugins' ) )
139           $dashboard_widgets[] = 'dashboard_plugins';
140      $dashboard_widgets[] = 'dashboard_secondary';
141
142      // Filter widget order
143      $dashboard_widgets = apply_filters( 'wp_dashboard_widgets', $dashboard_widgets );
144
145      $wp_dashboard_sidebars = array( 'wp_dashboard' => $dashboard_widgets, 'array_version' => 3.5 );
146
147      add_filter( 'dynamic_sidebar_params', 'wp_dashboard_dynamic_sidebar_params' );
148
149      if ( 'POST' == $_SERVER['REQUEST_METHOD'] && isset($_POST['widget_id']) ) {
150           ob_start(); // hack - but the same hack wp-admin/widgets.php uses
151           wp_dashboard_trigger_widget_control( $_POST['widget_id'] );
152           ob_end_clean();