Title: xfn_check
Published: April 25, 2014
Last modified: February 24, 2026

---

# xfn_check( string $xfn_relationship, string $xfn_value, mixed $deprecated )

## In this article

 * [Parameters](https://developer.wordpress.org/reference/functions/xfn_check/?output_format=md#parameters)
 * [Source](https://developer.wordpress.org/reference/functions/xfn_check/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/functions/xfn_check/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/xfn_check/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/functions/xfn_check/?output_format=md#wp--skip-link--target)

Displays ‘checked’ checkboxes attribute for XFN microformat options.

## 󠀁[Parameters](https://developer.wordpress.org/reference/functions/xfn_check/?output_format=md#parameters)󠁿

 `$xfn_relationship`stringrequired

XFN relationship category. Possible values are: `'friendship'`, `'physical'`, `'
professional'`, `'geographical'`, `'family'`, `'romantic'`, `'identity'`.

`$xfn_value`stringoptional

The XFN value to mark as checked if it matches the current link’s relationship.

Default empty string.

`$deprecated`mixedoptional

Deprecated. Not used.

## 󠀁[Source](https://developer.wordpress.org/reference/functions/xfn_check/?output_format=md#source)󠁿

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

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

    	$link_rel  = isset( $link->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"';
    		}
    	}
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/meta-boxes.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-admin/includes/meta-boxes.php#L1261)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-admin/includes/meta-boxes.php#L1261-L1303)

## 󠀁[Related](https://developer.wordpress.org/reference/functions/xfn_check/?output_format=md#related)󠁿

| Uses | Description | 
| [_deprecated_argument()](https://developer.wordpress.org/reference/functions/_deprecated_argument/)`wp-includes/functions.php` |

Marks a function argument as deprecated and inform when it has been used.

  |

| Used by | Description | 
| [link_xfn_meta_box()](https://developer.wordpress.org/reference/functions/link_xfn_meta_box/)`wp-admin/includes/meta-boxes.php` |

Displays XFN form fields.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/functions/xfn_check/?output_format=md#changelog)󠁿

| Version | Description | 
| [1.0.1](https://developer.wordpress.org/reference/since/1.0.1/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fxfn_check%2F)
before being able to contribute a note or feedback.