Fires after all default WordPress widgets have been registered.
Source
do_action( 'widgets_init' );
Changelog
| Version | Description |
|---|---|
| 2.2.0 | Introduced. |
| CARVIEW |
Fires after all default WordPress widgets have been registered.
do_action( 'widgets_init' );
| Used by | Description |
|---|---|
wp_widgets_init()wp-includes/widgets.php | Registers all of the default WordPress widgets on startup. |
| Version | Description |
|---|---|
| 2.2.0 | Introduced. |
You must log in before being able to contribute a note or feedback.
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.add_action( 'init', 'wpdocs_my_init', 0 ); function wpdocs_my_init() { $terms = get_terms( 'ts_product_brand', array( 'hide_empty' => true ) ); if ( ! is_array( $terms ) || count( $terms ) < 2 ) { remove_action( 'widgets_init', 'ts_product_filter_by_brand_load_widget' ); } }For example, used with registering sidebars: