WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru Платформа для конвертации и монетизации трафика
функция не описана

wp_default_packages_scripts() WP 5.0.0

Registers all the WordPress packages scripts that are in the standardized js/dist/ location.

For the order of $scripts->add wp_default_scripts().

Хуков нет.

Возвращает

Null. Ничего.

Использование

wp_default_packages_scripts( $scripts );
$scripts(WP_Scripts) (обязательный)
WP_Scripts object.

Список изменений

С версии 5.0.0 Введена.

Код wp_default_packages_scripts() WP 5.5.3

<?php
function wp_default_packages_scripts( $scripts ) {
	$suffix = wp_scripts_get_suffix();

	// Expects multidimensional array like:
	//	'a11y.js' => array('dependencies' => array(...), 'version' => '...'),
	//	'annotations.js' => array('dependencies' => array(...), 'version' => '...'),
	//	'api-fetch.js' => array(...
	$assets = include ABSPATH . WPINC . '/assets/script-loader-packages.php';

	foreach ( $assets as $package_name => $package_data ) {
		$basename = basename( $package_name, '.js' );
		$handle   = 'wp-' . $basename;
		$path     = "/wp-includes/js/dist/{$basename}{$suffix}.js";

		if ( ! empty( $package_data['dependencies'] ) ) {
			$dependencies = $package_data['dependencies'];
		} else {
			$dependencies = array();
		}

		// Add dependencies that cannot be detected and generated by build tools.
		switch ( $handle ) {
			case 'wp-block-library':
				array_push( $dependencies, 'editor' );
				break;
			case 'wp-edit-post':
				array_push( $dependencies, 'media-models', 'media-views', 'postbox', 'wp-dom-ready' );
				break;
		}

		$scripts->add( $handle, $path, $dependencies, $package_data['version'], 1 );

		if ( in_array( 'wp-i18n', $dependencies, true ) ) {
			$scripts->set_translations( $handle );
		}
	}
}