# wp_default_packages_vendor()

URL: https://chugunov.pro/api-wordpress/functions/wp_default_packages_vendor/
Проверено на WordPress 6.9, обновлено 06.08.2026.
Источник: независимый русскоязычный справочник chugunov.pro. Не является официальной документацией WordPress.

Тип: функция.
Появился в версии: 5.0.0.

## Сигнатура

```php
wp_default_packages_vendor( WP_Scripts $scripts )
```

## Описание

О порядке $scripts->add см. wp_default_scripts.

## Параметры

- `$scripts` `WP_Scripts` — обязательный. Объект WP_Scripts.

## Исходный код

Файл: `wp-includes/script-loader.php:85`

```php
function wp_default_packages_vendor( $scripts ) {
	global $wp_locale;

	$suffix = wp_scripts_get_suffix();

	$vendor_scripts = array(
		'react'                       => array(),
		'react-dom'                   => array( 'react' ),
		'react-jsx-runtime'           => array( 'react' ),
		'regenerator-runtime'         => array(),
		'moment'                      => array(),
		'lodash'                      => array(),
		'wp-polyfill-fetch'           => array(),
		'wp-polyfill-formdata'        => array(),
		'wp-polyfill-node-contains'   => array(),
		'wp-polyfill-url'             => array(),
		'wp-polyfill-dom-rect'        => array(),
		'wp-polyfill-element-closest' => array(),
		'wp-polyfill-object-fit'      => array(),
		'wp-polyfill-inert'           => array(),
		'wp-polyfill'                 => array(),
	);

	$vendor_scripts_versions = array(
		'react'                       => '18.3.1.1', // Final .1 due to switch to UMD build, can be removed in the next update.
		'react-dom'                   => '18.3.1.1', // Final .1 due to switch to UMD build, can be removed in the next update.
		'react-jsx-runtime'           => '18.3.1',
		'regenerator-runtime'         => '0.14.1',
		'moment'                      => '2.30.1',
		'lodash'                      => '4.18.1',
		'wp-polyfill-fetch'           => '3.6.20',
		'wp-polyfill-formdata'        => '4.0.10',
		'wp-polyfill-node-contains'   => '4.8.0',
		'wp-polyfill-url'             => '3.6.4',
		'wp-polyfill-dom-rect'        => '4.8.0',
		'wp-polyfill-element-closest' => '3.0.2',
		'wp-polyfill-object-fit'      => '2.3.5',
		'wp-polyfill-inert'           => '3.1.3',
		'wp-polyfill'                 => '3.15.0',
	);

	foreach ( $vendor_scripts as $handle => $dependencies ) {
		$scripts->add(
			$handle,
			"/wp-includes/js/dist/vendor/$handle$suffix.js",
			$dependencies,
			$vendor_scripts_versions[ $handle ],
			1
		);
	}

	did_action( 'init' ) && $scripts->add_inline_script( 'lodash', 'window.lodash = _.noConflict();' );

	did_action( 'init' ) && $scripts->add_inline_script(
		'moment',
		sprintf(
			"moment.updateLocale( '%s', %s );",
			esc_js( get_user_locale() ),
			wp_json_encode(
				array(
					'months'         => array_values( $wp_locale->month ),
					'monthsShort'    => array_values( $wp_locale->month_abbrev ),
					'weekdays'       => array_values( $wp_locale->weekday ),
					'weekdaysShort'  => array_values( $wp_locale->weekday_abbrev ),
					'week'           => array(
						'dow' => (int) get_option( 'start_of_week', 0 ),
					),
					'longDateFormat' => array(
						'LT'   => get_option( 'time_format', __( 'g:i a' ) ),
						'LTS'  => null,
						'L'    => null,
						'LL'   => get_option( 'date_format', __( 'F j, Y' ) ),
						'LLL'  => __( 'F j, Y g:i a' ),
						'LLLL' => null,
					),
				),
				JSON_HEX_TAG | JSON_UNESCAPED_SLASHES
			)
		),
		'after'
	);
}
```

## История изменений

- 5.0.0 — Introduced.

## Связанные

Использует: [`wp_scripts_get_suffix`](https://chugunov.pro/api-wordpress/functions/wp_scripts_get_suffix/), [`get_user_locale`](https://chugunov.pro/api-wordpress/functions/get_user_locale/), [`esc_js`](https://chugunov.pro/api-wordpress/functions/esc_js/), [`did_action`](https://chugunov.pro/api-wordpress/functions/did_action/), [`wp_json_encode`](https://chugunov.pro/api-wordpress/functions/wp_json_encode/), [`__`](https://chugunov.pro/api-wordpress/functions/__/), [`get_option`](https://chugunov.pro/api-wordpress/functions/get_option/).
Используется в: [`wp_default_packages`](https://chugunov.pro/api-wordpress/functions/wp_default_packages/).

Оригинал в официальной документации: https://developer.wordpress.org/reference/functions/wp_default_packages_vendor/
