@DimDim7778

Что это за ошибка на сайте Wordpress + Woocommerce и как её исправить?

Здравствуйте.
Добавлял новый функционал на сайт через файл темы functions.php
Решил проверить. Включил
define('WP_DEBUG', true);
и получил вот такое уведомление:
Notice: wp_enqueue_style was called incorrectly. Scripts and styles should not be registered or enqueued until the wp_enqueue_scripts, admin_enqueue_scripts, or login_enqueue_scripts hooks. Please see Debugging in WordPress for more information. (This message was added in version 3.3.0.) in /public_html/wp-includes/functions.php on line 4773 Notice: wp_enqueue_style was called incorrectly. Scripts and styles should not be registered or enqueued until the wp_enqueue_scripts, admin_enqueue_scripts, or login_enqueue_scripts hooks. Please see Debugging in WordPress for more information. (This message was added in version 3.3.0.) in /public_html/wp-includes/functions.php on line 4773

В сети нашёл такой же вопрос, но пока он без ответа:
https://stackoverflow.com/questions/56471327/home-...
Подскажите, что это может быть?
  • Вопрос задан
  • 413 просмотров
Пригласить эксперта
Ответы на вопрос 1
deniscopro
@deniscopro Куратор тега WordPress
WordPress-разработчик, denisco.pro
Здравствуйте.

Разместите вызов функции wp_enqueue_style в хуке wp_enqueue_scripts.

Пример:
add_action( 'wp_enqueue_scripts', 'theme_name_scripts' );
function theme_name_scripts() {
	wp_enqueue_style( 'style-name', get_stylesheet_uri() );
}
Ответ написан
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы