load_default_widgets
Filters whether to load the Widgets library.
Returning a falsey value from the filter will effectively short-circuit the Widgets library from loading.
Usage
add_filter( 'load_default_widgets', 'wp_kama_load_default_widgets_filter' );
/**
* Function for `load_default_widgets` filter-hook.
*
* @param bool $wp_maybe_load_widgets Whether to load the Widgets library.
*
* @return bool
*/
function wp_kama_load_default_widgets_filter( $wp_maybe_load_widgets ){
// filter...
return $wp_maybe_load_widgets;
}
- $wp_maybe_load_widgets(true|false)
- Whether to load the Widgets library.
Default: true
Changelog
| Since 2.8.0 | Introduced. |
Where the hook is called
load_default_widgets
wp-includes/functions.php 5437
if ( ! apply_filters( 'load_default_widgets', true ) ) {