Title: the_widget
Published: April 25, 2014
Last modified: April 28, 2025

---

# do_action( ‘the_widget’, string $widget, array $instance, array $args )

## In this article

 * [Parameters](https://developer.wordpress.org/reference/hooks/the_widget/?output_format=md#parameters)
 * [Source](https://developer.wordpress.org/reference/hooks/the_widget/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/hooks/the_widget/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/hooks/the_widget/?output_format=md#changelog)
 * [User Contributed Notes](https://developer.wordpress.org/reference/hooks/the_widget/?output_format=md#user-contributed-notes)

[ Back to top](https://developer.wordpress.org/reference/hooks/the_widget/?output_format=md#wp--skip-link--target)

Fires before rendering the requested widget.

## 󠀁[Parameters](https://developer.wordpress.org/reference/hooks/the_widget/?output_format=md#parameters)󠁿

 `$widget`string

The widget’s class name.

`$instance`array

The current widget instance’s settings.

`$args`array

An array of the widget’s sidebar arguments.

## 󠀁[Source](https://developer.wordpress.org/reference/hooks/the_widget/?output_format=md#source)󠁿

    ```php
    do_action( 'the_widget', $widget, $instance, $args );
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/widgets.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-includes/widgets.php#L1266)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/widgets.php#L1266-L1266)

## 󠀁[Related](https://developer.wordpress.org/reference/hooks/the_widget/?output_format=md#related)󠁿

| Used by | Description | 
| [the_widget()](https://developer.wordpress.org/reference/functions/the_widget/)`wp-includes/widgets.php` |

Outputs an arbitrary widget as a template tag.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/hooks/the_widget/?output_format=md#changelog)󠁿

| Version | Description | 
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |

## 󠀁[User Contributed Notes](https://developer.wordpress.org/reference/hooks/the_widget/?output_format=md#user-contributed-notes)󠁿

 1.  [Skip to note 2 content](https://developer.wordpress.org/reference/hooks/the_widget/?output_format=md#comment-content-6439)
 2.   [wpexplorer](https://profiles.wordpress.org/wpexplorer/)  [  3 years ago  ](https://developer.wordpress.org/reference/hooks/the_widget/#comment-6439)
 3. [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fthe_widget%2F%23comment-6439)
    Vote results for this note: 0[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fthe_widget%2F%23comment-6439)
 4. This action hook only fires when using the [the_widget()](https://developer.wordpress.org/reference/functions/the_widget/)
    function. It does not fire when widgets are rendered within a widgetized area (
    sidebar).
 5.  [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fthe_widget%2F%3Freplytocom%3D6439%23feedback-editor-6439)

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fthe_widget%2F)
before being able to contribute a note or feedback.