the_widget
Fires before rendering the requested widget.
Description
Parameters (3)
- 0. $widget (string)
- The widget's class name.
- 1. $instance (array)
- The current widget instance's settings.
- 2. $args (array)
- An array of the widget's sidebar arguments.
Usage
- To run the hook, copy the example below.
- // run the action
- do_action( 'the_widget', $widget, $instance, $args );
- The following example is for adding a hook callback.
- // define the the_widget callback
- function action_the_widget( $widget, $instance, $args ) {
- // make action magic happen here...
- };
- // add the action
- add_action( 'the_widget', 'action_the_widget', 10, 3 );
- To remove a hook callback, use the example below.
- // remove the action
- remove_action( 'the_widget', 'action_the_widget', 10, 3 );
Defined (1)
The action is defined in the following location(s).
- /wp-includes/widgets.php
- do_action( 'the_widget', $widget, $instance, $args );