do_action( 'widgets_init' )
Fires after all default WordPress widgets have been registered.
Description Description
Source Source
File: wp-includes/widgets.php
Changelog Changelog
| Version | Description |
|---|---|
| 2.2.0 | Introduced. |
User Contributed Notes User Contributed Notes
You must log in before being able to contribute a note or feedback.
For example, used with registering sidebars:
function mytheme_widgets_init() { register_sidebar( array( 'name' => __( 'Single Post Widgets', 'textdomain' ), 'id' => 'mytheme-single-post-widgets', 'description' => __( 'Widgets in this area will be shown under your single posts, before comments.', 'textdomain' ), 'before_widget' => '', 'after_widget' => '', 'before_title' => '', 'after_title' => '', ) ); } add_action( 'widgets_init', 'mytheme_widgets_init' );You should note that the
widgets_inithook is fired as part of theinithook – with a priority of 1.This means that it will fire before any code you may add to the
inithook with a default priority.