WP hooks navigation: Home/browse • Actions index • Filters index
To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).
The best way to understand what a hook does is to look at where it occurs in the source code.
do_action( "hook_name" )apply_filters( "hook_name", "what_to_filter" ).Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.
This hook occurs 2 times in this file.
| Line | Code |
|---|---|
| 626 | $index = $key; |
| 627 | break; |
| 628 | } |
| 629 | } |
| 630 | } |
| 631 | |
| 632 | $sidebars_widgets = wp_get_sidebars_widgets(); |
| 633 | if ( empty( $wp_registered_sidebars[ $index ] ) || empty( $sidebars_widgets[ $index ] ) || ! is_array( $sidebars_widgets[ $index ] ) ) { |
| 634 | /** This action is documented in wp-includes/widget.php */ |
| 635 | do_action( 'dynamic_sidebar_before', $index, false ); |
| 636 | /** This action is documented in wp-includes/widget.php */ |
| 637 | do_action( 'dynamic_sidebar_after', $index, false ); |
| 638 | /** This filter is documented in wp-includes/widget.php */ |
| 639 | return apply_filters( 'dynamic_sidebar_has_widgets', false, $index ); |
| 640 | } |
| 641 | |
| 642 | /** |
| 643 | * Fires before widgets are rendered in a dynamic sidebar. |
| 644 | * |
| 645 | * Note: The action also fires for empty sidebars, and on both the front end |
| 646 | * and back end, including the Inactive Widgets sidebar on the Widgets screen. |
| 647 | * |
| 648 | * @since 3.9.0 |
| 649 | * |
| 650 | * @param int|string $index Index, name, or ID of the dynamic sidebar. |
| 651 | * @param bool $has_widgets Whether the sidebar is populated with widgets. |
| 652 | * Default true. |
| 653 | */ |
| 654 | do_action( 'dynamic_sidebar_before', $index, true ); |
| 655 | $sidebar = $wp_registered_sidebars[$index]; |
| 656 | |
| 657 | $did_one = false; |
| 658 | foreach ( (array) $sidebars_widgets[$index] as $id ) { |
| 659 | |
| 660 | if ( !isset($wp_registered_widgets[$id]) ) continue; |
| 661 | |
| 662 | $params = array_merge( |
| 663 | array( array_merge( $sidebar, array('widget_id' => $id, 'widget_name' => $wp_registered_widgets[$id]['name']) ) ), |