wp_maybe_load_widgets()
Проверено на WordPress 6.9, обновлено Источник: WordPress Developer Resources.
Сигнатура
wp_maybe_load_widgets()
Описание
Проверяет, не была ли библиотека виджетов уже загружена.
Если нет, загружает библиотеку виджетов и запускает хук-действие.
Оригинал (английский)
Checks to make sure that the widgets library hasn’t already been loaded.
If it hasn’t, then it will load the widgets library and run an action hook.
Исходный код
wp-includes/functions.php:5437
function wp_maybe_load_widgets() {
/**
* 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.
*/
if ( ! apply_filters( 'load_default_widgets', true ) ) {
return;
}
require_once ABSPATH . WPINC . '/default-widgets.php';
add_action( '_admin_menu', 'wp_widgets_add_menu' );
}
История изменений
| Версия | Описание |
|---|---|
| 2.2.0 | Introduced. |

