the_widget
Action HookDescription
Fires before rendering the requested widget.Hook Information
File Location |
wp-includes/widgets.php
View on GitHub
|
Hook Type | Action |
Line Number | 1266 |
Hook Parameters
Type | Name | Description |
---|---|---|
string
|
$widget
|
The widget's class name. |
array
|
$instance
|
The current widget instance's settings. |
array
|
$args
|
An array of the widget's sidebar arguments. |
Usage Examples
Basic Usage
<?php
// Hook into the_widget
add_action('the_widget', 'my_custom_function', 10, 3);
function my_custom_function($widget, $instance, $args) {
// Your custom code here
}
Source Code Context
wp-includes/widgets.php:1266
- How this hook is used in WordPress core
<?php
1261 *
1262 * @param string $widget The widget's class name.
1263 * @param array $instance The current widget instance's settings.
1264 * @param array $args An array of the widget's sidebar arguments.
1265 */
1266 do_action( 'the_widget', $widget, $instance, $args );
1267
1268 $widget_obj->_set( -1 );
1269 $widget_obj->widget( $args, $instance );
1270 }
1271
PHP Documentation
<?php
/**
* Fires before rendering the requested widget.
*
* @since 3.0.0
*
* @param string $widget The widget's class name.
* @param array $instance The current widget instance's settings.
* @param array $args An array of the widget's sidebar arguments.
*/
Quick Info
- Hook Type: Action
- Parameters: 3
- File: wp-includes/widgets.php
Related Hooks
Related hooks will be displayed here in future updates.