do_action( 'widgets_init' )

Fires after all default WordPress widgets have been registered.


Source

File: wp-includes/widgets.php. View all references

do_action( 'widgets_init' );


Top ↑

Changelog

Changelog
Version Description
2.2.0 Introduced.

Top ↑

User Contributed Notes

  1. Skip to note 1 content
    Contributed by Vail Joy

    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' );
  2. Skip to note 2 content
    Contributed by markcallen

    You should note that the widgets_init hook is fired as part of the init hook – with a priority of 1.

    This means that it will fire before any code you may add to the init hook with a default priority.

You must log in before being able to contribute a note or feedback.