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
2336           $sidebar = array_diff( $sidebar, array( $widget_id ) );
2337           $_POST   = array(
2338                'sidebar'            => $sidebar_id,
2339                'widget-' . $id_base => array(),
2340                'the-widget-id'      => $widget_id,
2341                'delete_widget'      => '1',
2342           );
2343
2344           /** This action is documented in wp-admin/widgets.php */
2345           do_action( 'delete_widget', $widget_id, $sidebar_id, $id_base );
2346
2347      } elseif ( $settings && preg_match( '/__i__|%i%/', key( $settings ) ) ) {
2348           if ( ! $multi_number ) {
2349                wp_die( $error );
2350           }
2351
2352           $_POST[ 'widget-' . $id_base ] = array( $multi_number => reset( $settings ) );
2353           $widget_id                     = $id_base . '-' . $multi_number;
2354           $sidebar[]                     = $widget_id;