wppaste
WordPress

do_action( 'dynamic_sidebar_before', int|string $index, bool $has_widgets )

Since
3.9.0
Fires before widgets are rendered in a dynamic sidebar.

Description

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.

Compatibility

WordPress
since 3.9.0
  • 6.7.10
  • 6.8.11
  • 6.9.10
  • 7.0.7
  • 7.1.3

Present in every tracked release (6.7.10 to 7.1.3).

Parameters

$indexint|string
Index, name, or ID of the dynamic sidebar.
$has_widgetsbool
Whether the sidebar is populated with widgets.
Default true.

Where this hook fires · 2

  • wp-includes/widgets.php:717dynamic_sidebar()
  • wp-includes/widgets.php:740dynamic_sidebar()

Source code

	 * @since 3.9.0	 *	 * @param int|string $index       Index, name, or ID of the dynamic sidebar.	 * @param bool       $has_widgets Whether the sidebar is populated with widgets.	 *                                Default true.	 */	do_action( 'dynamic_sidebar_before', $index, true ); 	if ( ! is_admin() && ! empty( $sidebar['before_sidebar'] ) ) {		echo $sidebar['before_sidebar'];	} 	$did_one = false;

Changelog

Introduced in 3.9.0. Unchanged from 6.7.10 through 7.1.3.

  1. 6.7.10
  2. 6.8.11
  3. 6.9.10
  4. 7.0.7
  5. 7.1.3

Signature, return type and hooks compared across 5 parsed releases.

About this page

Parsed data
Generated from the wordpress-develop 7.1.3 tag, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.