Где в WP подключается родной jquery?

Подскажите, пожалуйста, где в Wordpress по умолчанию подключается jquery?
Проблема в том, что я хочу попробовать их отключить, чтобы они не загружались.
Сейчас грузятся такие файлы
/wp-includes/js/jquery/jquery-migrate.min.js?ver=1.4.1
/wp-includes/js/jquery/jquery.js?ver=1.12.4
Где они прописываются? Я знаю, что можно отключить через function.php, но хочу узнать первоисточник.
  • Вопрос задан
  • 2393 просмотра
Решения вопроса 1
kumaxim
@kumaxim
Web-программист
Читам документацию по функции wp_register_script

Выключаем родной JQuery примерно так wp_dequeue_script( 'jquery' ) или wp_deregister_script( 'jquery' );

Первоисточник - сделайте поиск ключевого слова 'jqeury' по содержимому файлов в папке wp-includes.
Ответ написан
Комментировать
Пригласить эксперта
Ответы на вопрос 2
BBoyJuss
@BBoyJuss
WordPress, интерфейсы и все вытекающие
@max3wq
WP 5.6
wp-includes/functions.wp-scripts.php

function wp_deregister_script( $handle ) {
	_wp_scripts_maybe_doing_it_wrong( __FUNCTION__, $handle );

	/**
	 * Do not allow accidental or negligent de-registering of critical scripts in the admin.
	 * Show minimal remorse if the correct hook is used.
	 */
	$current_filter = current_filter();
	if ( ( is_admin() && 'admin_enqueue_scripts' !== $current_filter ) ||
		( 'wp-login.php' === $GLOBALS['pagenow'] && 'login_enqueue_scripts' !== $current_filter )
	) {
		$not_allowed = array(
			'jquery',
			'jquery-core',
			'jquery-migrate',
			'jquery-ui-core',
			'jquery-ui-accordion',
			'jquery-ui-autocomplete',
			'jquery-ui-button',
			'jquery-ui-datepicker',
			'jquery-ui-dialog',
			'jquery-ui-draggable',
			'jquery-ui-droppable',
			'jquery-ui-menu',
			'jquery-ui-mouse',
			'jquery-ui-position',
			'jquery-ui-progressbar',
			'jquery-ui-resizable',
			'jquery-ui-selectable',
			'jquery-ui-slider',
			'jquery-ui-sortable',
			'jquery-ui-spinner',
			'jquery-ui-tabs',
			'jquery-ui-tooltip',
			'jquery-ui-widget',
			'underscore',
			'backbone',
		);

		if ( in_array( $handle, $not_allowed, true ) ) {
			$message = sprintf(
				/* translators: 1: Script name, 2: wp_enqueue_scripts */
				__( 'Do not deregister the %1$s script in the administration area. To target the front-end theme, use the %2$s hook.' ),
				"<code>$handle</code>",
				'<code>wp_enqueue_scripts</code>'
			);
			_doing_it_wrong( __FUNCTION__, $message, '3.6.0' );
			return;
		}
	}

	wp_scripts()->remove( $handle );
}
Ответ написан
Комментировать
Ваш ответ на вопрос

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

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