dynamic_sidebar_before action-hook . WP 3.9.0
Fires before widgets are rendered in a dynamic sidebar.
Note: The action also fires for empty sidebars, and on both the front end and back end, including the Inactive Widgets sidebar on the Widgets screen.
Usage
add_action( 'dynamic_sidebar_before', 'action_function_name_6866', 10, 2 ); function action_function_name_6866( $index, $has_widgets ){ // action... }
- $index(int|string)
- Index, name, or ID of the dynamic sidebar.
- $has_widgets(true/false)
- Whether the sidebar is populated with widgets.
Default: true
Changelog
Since 3.9.0 | Introduced. |
Where the hook is called
dynamic_sidebar_before
wp-includes/widgets.php 721
do_action( 'dynamic_sidebar_before', $index, true );
wp-includes/widgets.php 698
do_action( 'dynamic_sidebar_before', $index, false );
Where in WP core the hook is used WordPress
wp-includes/class-wp-customize-widgets.php 1627
add_action( 'dynamic_sidebar_before', array( $this, 'start_dynamic_sidebar' ) );