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 |
---|---|
706 | $index = $key; |
707 | break; |
708 | } |
709 | } |
710 | } |
711 |
|
712 | $sidebars_widgets = wp_get_sidebars_widgets(); |
713 | if ( empty( $wp_registered_sidebars[ $index ] ) || empty( $sidebars_widgets[ $index ] ) || ! is_array( $sidebars_widgets[ $index ] ) ) { |
714 | /** This action is documented in wp-includes/widget.php */ |
715 | do_action( 'dynamic_sidebar_before', $index, false ); |
716 | /** This action is documented in wp-includes/widget.php */ |
717 | do_action( 'dynamic_sidebar_after', $index, false ); |
718 | /** This filter is documented in wp-includes/widget.php */ |
719 | return apply_filters( 'dynamic_sidebar_has_widgets', false, $index ); |
720 | } |
721 |
|
722 | $sidebar = $wp_registered_sidebars[ $index ]; |
723 |
|
724 | $sidebar['before_sidebar'] = sprintf( $sidebar['before_sidebar'], $sidebar['id'], $sidebar['class'] ); |
Line | Code |
729 | * Note: The action also fires for empty sidebars, and on both the front end |
730 | * and back end, including the Inactive Widgets sidebar on the Widgets screen. |
731 | * |
732 | * @since 3.9.0 |
733 | * |
734 | * @param int|string $index Index, name, or ID of the dynamic sidebar. |
735 | * @param bool $has_widgets Whether the sidebar is populated with widgets. |
736 | * Default true. |
737 | */ |
738 | do_action( 'dynamic_sidebar_before', $index, true ); |
739 |
|
740 | if ( ! is_admin() && ! empty( $sidebar['before_sidebar'] ) ) { |
741 | echo $sidebar['before_sidebar']; |
742 | } |
743 |
|
744 | $did_one = false; |
745 | foreach ( (array) $sidebars_widgets[ $index ] as $id ) { |
746 |
|
747 | if ( ! isset( $wp_registered_widgets[ $id ] ) ) { |