Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: delete_widget

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
1949      if ( isset($_POST['delete_widget']) && $_POST['delete_widget'] ) {
1950
1951           if ( !isset($wp_registered_widgets[$widget_id]) )
1952                wp_die( $error );
1953
1954           $sidebar = array_diff( $sidebar, array($widget_id) );
1955           $_POST = array('sidebar' => $sidebar_id, 'widget-' . $id_base => array(), 'the-widget-id' => $widget_id, 'delete_widget' => '1');
1956
1957           /** This action is documented in wp-admin/widgets.php */
1958           do_action( 'delete_widget', $widget_id, $sidebar_id, $id_base );
1959
1960      } elseif ( $settings && preg_match( '/__i__|%i%/', key($settings) ) ) {
1961           if ( !$multi_number )
1962                wp_die( $error );
1963
1964           $_POST[ 'widget-' . $id_base ] = array( $multi_number => reset( $settings ) );
1965           $widget_id = $id_base . '-' . $multi_number;
1966           $sidebar[] = $widget_id;
1967      }