WordPress.org

Make WordPress Core

Changeset 34714


Ignore:
Timestamp:
09/30/2015 03:20:41 AM (4 years ago)
Author:
DrewAPicture
Message:

Widgets: Introduce a delete_widget action, which fires after a widget has been marked for deletion.

Props afercia for the initial patch.
Fixes #27444.

Location:
trunk/src/wp-admin
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/ajax-actions.php

    r34500 r34714  
    18781878        $sidebar = array_diff( $sidebar, array($widget_id) );
    18791879        $_POST = array('sidebar' => $sidebar_id, 'widget-' . $id_base => array(), 'the-widget-id' => $widget_id, 'delete_widget' => '1');
     1880
     1881        /** This action is documented in wp-admin/widgets.php */
     1882        do_action( 'delete_widget', $widget_id, $sidebar_id, $id_base );
     1883
    18801884    } elseif ( $settings && preg_match( '/__i__|%i%/', key($settings) ) ) {
    18811885        if ( !$multi_number )
  • trunk/src/wp-admin/widgets.php

    r34392 r34714  
    153153        $sidebar = array_diff( $sidebar, array($widget_id) );
    154154        $_POST = array('sidebar' => $sidebar_id, 'widget-' . $id_base => array(), 'the-widget-id' => $widget_id, 'delete_widget' => '1');
     155
     156        /**
     157         * Fires immediately after a widget has been marked for deletion.
     158         *
     159         * @since 4.4.0
     160         *
     161         * @param string $widget_id  ID of the widget marked for deletion.
     162         * @param string $sidebar_id ID of the sidebar the widget was deleted from.
     163         * @param string $id_base    ID base for the widget.
     164         */
     165        do_action( 'delete_widget', $widget_id, $sidebar_id, $id_base );
    155166    }
    156167
Note: See TracChangeset for help on using the changeset viewer.