dynamic_sidebar

Fires before a widget's display callback is called.

Description

do_action( 'dynamic_sidebar', (array) $wp_registered_widgets_id ); 

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.

Parameters (1)

0. $wp_registered_widgets_id (array)

Usage

To run the hook, copy the example below.
  1. // run the action 
  2. do_action( 'dynamic_sidebar', $wp_registered_widgets_id ); 
The following example is for adding a hook callback.
  1. // define the dynamic_sidebar callback 
  2. function action_dynamic_sidebar( $wp_registered_widgets_id ) { 
  3. // make action magic happen here... 
  4. }; 
  5.  
  6. // add the action 
  7. add_action( 'dynamic_sidebar', 'action_dynamic_sidebar', 10, 1 ); 
To remove a hook callback, use the example below.
  1. // remove the action 
  2. remove_action( 'dynamic_sidebar', 'action_dynamic_sidebar', 10, 1 ); 

Defined (1)

The action is defined in the following location(s).

/wp-includes/widgets.php  
  1. do_action( 'dynamic_sidebar', $wp_registered_widgets[ $id ] );