is_active_sidebar
Filters whether a dynamic sidebar is considered "active".
Usage
add_filter( 'is_active_sidebar', 'wp_kama_is_active_sidebar_filter', 10, 2 ); /** * Function for `is_active_sidebar` filter-hook. * * @param bool $is_active_sidebar Whether or not the sidebar should be considered "active". In other words, whether the sidebar contains any widgets. * @param int|string $index Index, name, or ID of the dynamic sidebar. * * @return bool */ function wp_kama_is_active_sidebar_filter( $is_active_sidebar, $index ){ // filter... return $is_active_sidebar; }
- $is_active_sidebar(true|false)
- Whether or not the sidebar should be considered "active". In other words, whether the sidebar contains any widgets.
- $index(int|string)
- Index, name, or ID of the dynamic sidebar.
Changelog
Since 3.9.0 | Introduced. |
Where the hook is called
is_active_sidebar
wp-includes/widgets.php 997
return apply_filters( 'is_active_sidebar', $is_active_sidebar, $index );
Where the hook is used in WordPress
wp-includes/class-wp-customize-widgets.php 125
add_filter( 'is_active_sidebar', array( $this, 'tally_sidebars_via_is_active_sidebar_calls' ), 10, 2 );