dynamic_sidebar_has_widgets WordPress Filter Hook

The dynamic_sidebar_has_widgets hook is used to determine whether a sidebar has any widgets assigned to it. This hook is fired when a sidebar is first registered or when a widget is added to or removed from a sidebar. If a sidebar has no widgets assigned to it, this hook will not be fired.

apply_filters( 'dynamic_sidebar_has_widgets', bool $did_one, int|string $index ) #

Filters whether a sidebar has widgets.


Description

Note: The filter is also evaluated for empty sidebars, and on both the front end and back end, including the Inactive Widgets sidebar on the Widgets screen.


Top ↑

Parameters

$did_one

(bool)Whether at least one widget was rendered in the sidebar. Default false.

$index

(int|string)Index, name, or ID of the dynamic sidebar.


Top ↑

Source

File: wp-includes/widgets.php

View on Trac



Top ↑

Changelog

Changelog
VersionDescription
3.9.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.