# wp_print_font_faces()

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

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

## Сигнатура

```php
wp_print_font_faces( array[][] $fonts = array() )
```

## Описание

Генерирует и выводит стили font-face для указанных шрифтов или шрифтов из theme.json.

## Параметры

- `$fonts` `array[][]` — необязательный, по умолчанию `array()`. The font-families and their font faces.
  
  - `...$0` array An indexed or associative (keyed by font-family) array of font variations for this font-family.
  
  Each font face has the following structure.
  
  - `...$0` array The font face properties.
  
  - `font-family` string The font-family property.
  
  - `src` string|string[] The URL(s) to each resource containing the font data.
  
  - `font-style` string Optional. The font-style property. Default `'normal'`.
  
  - `font-weight` string Optional. The font-weight property. Default `'400'`.
  
  - `font-display` string Optional. The font-display property. Default `'fallback'`.
  
  - `ascent-override` string Optional. The ascent-override property.
  
  - `descent-override` string Optional. The descent-override property.
  
  - `font-stretch` string Optional. The font-stretch property.
  
  - `font-variant` string Optional. The font-variant property.
  
  - `font-feature-settings` string Optional. The font-feature-settings property.
  
  - `font-variation-settings` string Optional. The font-variation-settings property.
  
  - `line-gap-override` string Optional. The line-gap-override property.
  
  - `size-adjust` string Optional. The size-adjust property.
  
  - `unicode-range` string Optional. The unicode-range property.
  
  }
  
  Default:`array()`
  
  [Source](#source)
  
  ```
  function wp_print_font_faces( $fonts = array() ) {
  
  if ( empty( $fonts ) ) {
  $fonts = WP_Font_Face_Resolver::get_fonts_from_theme_json();
  }
  
  if ( empty( $fonts ) ) {
  return;
  }
  
  $wp_font_face = new WP_Font_Face();
  $wp_font_face->generate_and_print( $fonts );
  }
  ```
  
  [View all references](https://developer.wordpress.org/reference/files/wp-includes/fonts.php/) [View on Trac](https://core.trac.wordpress.org/browser/tags/7.0/src/wp-includes/fonts.php#L43) [View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-includes/fonts.php#L43-L55)
  
  [Related](#related) Uses | Description |
  [WP_Font_Face_Resolver::get_fonts_from_theme_json()](https://developer.wordpress.org/reference/classes/wp_font_face_resolver/get_fonts_from_theme_json/)`wp-includes/fonts/class-wp-font-face-resolver.php` | Gets fonts defined in theme.json.
  |
  [WP_Font_Face::generate_and_print()](https://developer.wordpress.org/reference/classes/wp_font_face/generate_and_print/)`wp-includes/fonts/class-wp-font-face.php` | Generates and prints the `@font-face` styles for the given fonts.
  |
  Used by | Description |
  [wp_print_font_faces_from_style_variations()](https://developer.wordpress.org/reference/functions/wp_print_font_faces_from_style_variations/)`wp-includes/fonts.php` | Generates and prints font-face styles defined the the theme style variations.
  |
  [_wp_get_iframed_editor_assets()](https://developer.wordpress.org/reference/functions/_wp_get_iframed_editor_assets/)`wp-includes/block-editor.php` | Collect the block editor assets that need to be loaded into the editor’s iframe.
  |
  
  [Changelog](#changelog) Version | Description |
  [6.4.0](https://developer.wordpress.org/reference/since/6.4.0/) | Introduced. |
  
  [User Contributed Notes](#user-contributed-notes)
  -
  
  [Skip to note 2 content](#comment-content-6768)
  
  [Rodrigo Vieira Eufrasio da Silva](https://profiles.wordpress.org/rodrigomct/)
  [
  
  3 years ago
  ](https://developer.wordpress.org/reference/functions/wp_print_font_faces/#comment-6768)
  
  [You must log in to vote on the helpfulness of this note ](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_print_font_faces%2F%23comment-6768)Vote results for this note: -1 [You must log in to vote on the helpfulness of this note ](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_print_font_faces%2F%23comment-6768)
  
  ```
  $fonts = array(
  'font-family-1' => array(
  'variations' => array(
  'font-variation-1' => array(
  'font-family' => 'Font Family 1',
  'src' => array(
  'url-to-font-variation-1.woff',
  'url-to-font-variation-1.woff2',
  ),
  'font-style' => 'italic',
  'font-weight' => '700',
  // Other optional properties...
  ),
  // Add more variations if necessary...
  ),
  ),
  'font-family-2' => array(
  'variations' => array(
  'font-variation-2' => array(
  'font-family' => 'Font Family 2',
  'src' => array(
  'url-to-font-variation-2.woff',
  'url-to-font-variation-2.woff2',
  ),
  // Outras propriedades opcionais...
  ),
  // Add more variations if necessary...
  ),
  ),
  // Add more font families if necessary...
  );
  
  wp_print_font_faces( $fonts );
  ```
  
  [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_print_font_faces%2F%3Freplytocom%3D6768%23feedback-editor-6768)
  
  You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_print_font_faces%2F) before being able to contribute a note or feedback.

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

Файл: `wp-includes/fonts.php:43`

```php
function wp_print_font_faces( $fonts = array() ) {

	if ( empty( $fonts ) ) {
		$fonts = WP_Font_Face_Resolver::get_fonts_from_theme_json();
	}

	if ( empty( $fonts ) ) {
		return;
	}

	$wp_font_face = new WP_Font_Face();
	$wp_font_face->generate_and_print( $fonts );
}
```

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

- 6.4.0 — Introduced.

## Связанные

Использует: `WP_Font_Face_Resolver::get_fonts_from_theme_json`, `WP_Font_Face::generate_and_print`.
Используется в: [`wp_print_font_faces_from_style_variations`](https://chugunov.pro/api-wordpress/functions/wp_print_font_faces_from_style_variations/), [`_wp_get_iframed_editor_assets`](https://chugunov.pro/api-wordpress/functions/_wp_get_iframed_editor_assets/).

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