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,$callbackis an array containing the widget object. Fired on the back end,$callbackis '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,$_callbackis populated with an array containing the widget object, see$callback.
}$namestringName of the widget.$idstringWidget ID.$callbackcallableWhen the hook is fired on the front end,$callbackis an array containing the widget object. Fired on the back end,$callbackis 'wp_widget_control', see$_callback.$paramsarrayAn associative array of multi-widget arguments.$classnamestringCSS class applied to the widget container.$descriptionstringThe widget description.$_callbackarrayWhen the hook is fired on the back end,$_callbackis populated with an array containing the widget object, see$callback.
Where this hook fires · 2
wp-includes/widgets.php:844dynamic_sidebar()wp-includes/widgets.php:2054wp_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.
Signature, return type and hooks compared across 5 parsed releases.
About this page
- Parsed data
- Generated from the wordpress-develop 7.1.0 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.