# xfn_check()

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

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

## Сигнатура

```php
xfn_check( string $xfn_relationship, string $xfn_value = '', mixed $deprecated = '' )
```

## Описание

Отображает атрибут «checked» для флажков параметров микроформата XFN.

## Параметры

- `$xfn_relationship` `string` — обязательный. Категория отношений XFN. Возможные значения: 'friendship', 'physical', 'professional', 'geographical', 'family', 'romantic', 'identity'.
- `$xfn_value` `string` — необязательный, по умолчанию `''`. Значение XFN, которое нужно отметить как выбранное, если оно совпадает с отношением текущей ссылки.
- `$deprecated` `mixed` — необязательный, по умолчанию `''`. Устаревший. Не используется.

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

Файл: `wp-admin/includes/meta-boxes.php:1261`

```php
function xfn_check( $xfn_relationship, $xfn_value = '', $deprecated = '' ) {
	global $link;

	if ( ! empty( $deprecated ) ) {
		_deprecated_argument( __FUNCTION__, '2.5.0' ); // Never implemented.
	}

	$link_rel  = $link->link_rel ?? '';
	$link_rels = preg_split( '/\s+/', $link_rel );

	// Mark the specified value as checked if it matches the current link's relationship.
	if ( '' !== $xfn_value && in_array( $xfn_value, $link_rels, true ) ) {
		echo ' checked="checked"';
	}

	if ( '' === $xfn_value ) {
		// Mark the 'none' value as checked if the current link does not match the specified relationship.
		if ( 'family' === $xfn_relationship
			&& ! array_intersect( $link_rels, array( 'child', 'parent', 'sibling', 'spouse', 'kin' ) )
		) {
			echo ' checked="checked"';
		}

		if ( 'friendship' === $xfn_relationship
			&& ! array_intersect( $link_rels, array( 'friend', 'acquaintance', 'contact' ) )
		) {
			echo ' checked="checked"';
		}

		if ( 'geographical' === $xfn_relationship
			&& ! array_intersect( $link_rels, array( 'co-resident', 'neighbor' ) )
		) {
			echo ' checked="checked"';
		}

		// Mark the 'me' value as checked if it matches the current link's relationship.
		if ( 'identity' === $xfn_relationship
			&& in_array( 'me', $link_rels, true )
		) {
			echo ' checked="checked"';
		}
	}
}
```

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

- 1.0.1 — Introduced.

## Связанные

Использует: [`_deprecated_argument`](https://chugunov.pro/api-wordpress/functions/_deprecated_argument/).
Используется в: [`link_xfn_meta_box`](https://chugunov.pro/api-wordpress/functions/link_xfn_meta_box/).

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