Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: widgets-php

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

This hook occurs 2 times in this file.

Line Code
357       *
358       * @since 3.9.0
359       * @access public
360       */
361      public function customize_controls_init() {
362           /** This action is documented in wp-admin/includes/ajax-actions.php */
363           do_action( 'load-widgets.php' );
364
365           /** This action is documented in wp-admin/includes/ajax-actions.php */
366           do_action( 'widgets.php' );
367
368           /** This action is documented in wp-admin/widgets.php */
369           do_action( 'sidebar_admin_setup' );
370      }
371
372      /**
373       * Ensure widgets are available for all types of previews.
374       *
375       * When in preview, hook to 'customize_register' for settings
 
Line Code
1351
1352           if ( ! isset( $_POST['widget-id'] ) ) {
1353                wp_send_json_error();
1354           }
1355
1356           /** This action is documented in wp-admin/includes/ajax-actions.php */
1357           do_action( 'load-widgets.php' );
1358
1359           /** This action is documented in wp-admin/includes/ajax-actions.php */
1360           do_action( 'widgets.php' );
1361
1362           /** This action is documented in wp-admin/widgets.php */
1363           do_action( 'sidebar_admin_setup' );
1364
1365           $widget_id = $this->get_post_value( 'widget-id' );
1366           $parsed_id = $this->parse_widget_id( $widget_id );
1367           $id_base   = $parsed_id['id_base'];
1368
1369           if ( isset( $_POST['widget-' . $id_base] ) && is_array( $_POST['widget-' . $id_base] ) && preg_match( '/__i__|%i%/', key( $_POST['widget-' . $id_base] ) ) ) {