wppaste
WordPress

do_action( 'dynamic_sidebar', array $widget )

Since
3.0.0
Fires before a widget's display callback is called.

Description

Note: The action fires on both the front end and back end, including for widgets in the Inactive Widgets sidebar on the Widgets screen.

The action is not fired for empty sidebars.

Compatibility

WordPress
since 3.0.0
  • 6.7.7
  • 6.8.8
  • 6.9.7
  • 7.0.4
  • 7.1.0

Present in every tracked release (6.7.7 to 7.1.0).

Parameters

$widgetarray
{ An associative array of widget arguments.
@type string $name Name of the widget.
@type string $id Widget ID.
@type callable $callback When the hook is fired on the front end, $callback is an array containing the widget object. Fired on the back end, $callback is 'wp_widget_control', see $_callback.
@type array $params An associative array of multi-widget arguments.
@type string $classname CSS class applied to the widget container.
@type string $description The widget description.
@type array $_callback When the hook is fired on the back end, $_callback is populated with an array containing the widget object, see $callback.
}
  • $namestring

    Name of the widget.
  • $idstring

    Widget ID.
  • $callbackcallable

    When the hook is fired on the front end, $callback is an array containing the widget object. Fired on the back end, $callback is 'wp_widget_control', see $_callback.
  • $paramsarray

    An associative array of multi-widget arguments.
  • $classnamestring

    CSS class applied to the widget container.
  • $descriptionstring

    The widget description.
  • $_callbackarray

    When the hook is fired on the back end, $_callback is populated with an array containing the widget object, see $callback.

Where this hook fires · 2

  • wp-includes/widgets.php:842dynamic_sidebar()
  • wp-includes/widgets.php:2052wp_render_widget()

Source code

		 *     @type string   $classname   CSS class applied to the widget container.		 *     @type string   $description The widget description.		 *     @type array    $_callback   When the hook is fired on the back end, `$_callback` is populated		 *                                 with an array containing the widget object, see `$callback`.		 * }		 */		do_action( 'dynamic_sidebar', $wp_registered_widgets[ $id ] ); 		if ( is_callable( $callback ) ) {			call_user_func_array( $callback, $params );			$did_one = true;		}	}

Changelog

Introduced in 3.0.0. Unchanged from 6.7.7 through 7.1.0.

  1. 6.7.7
  2. 6.8.8
  3. 6.9.7
  4. 7.0.4
  5. 7.1.0

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

About this page

Parsed data
Generated from the wordpress-develop 6.9.7 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.