is_active_sidebar хук-фильтрWP 3.9.0

Filters whether a dynamic sidebar is considered "active".

Использование

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|строка)
Index, name, or ID of the dynamic sidebar.

Список изменений

С версии 3.9.0 Введена.

Где вызывается хук

is_active_sidebar()
is_active_sidebar
wp-includes/widgets.php 987
return apply_filters( 'is_active_sidebar', $is_active_sidebar, $index );

Где используется хук в 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 );