load_default_widgets
Filter HookDescription
Filters whether to load the Widgets library. Returning a falsey value from the filter will effectively short-circuit the Widgets library from loading.Hook Information
File Location |
wp-includes/functions.php
View on GitHub
|
Hook Type | Filter |
Line Number | 5427 |
Hook Parameters
Type | Name | Description |
---|---|---|
bool
|
$wp_maybe_load_widgets
|
Whether to load the Widgets library. Default true. |
Usage Examples
Basic Usage
<?php
// Hook into load_default_widgets
add_filter('load_default_widgets', 'my_custom_filter', 10, 1);
function my_custom_filter($wp_maybe_load_widgets) {
// Your custom filtering logic here
return $wp_maybe_load_widgets;
}
Source Code Context
wp-includes/functions.php:5427
- How this hook is used in WordPress core
<?php
5422 * @since 2.8.0
5423 *
5424 * @param bool $wp_maybe_load_widgets Whether to load the Widgets library.
5425 * Default true.
5426 */
5427 if ( ! apply_filters( 'load_default_widgets', true ) ) {
5428 return;
5429 }
5430
5431 require_once ABSPATH . WPINC . '/default-widgets.php';
5432
PHP Documentation
<?php
/**
* Filters whether to load the Widgets library.
*
* Returning a falsey value from the filter will effectively short-circuit
* the Widgets library from loading.
*
* @since 2.8.0
*
* @param bool $wp_maybe_load_widgets Whether to load the Widgets library.
* Default true.
*/
Quick Info
- Hook Type: Filter
- Parameters: 1
- File: wp-includes/functions.php
Related Hooks
Related hooks will be displayed here in future updates.