Using WordPress ‘link_xfn_meta_box()’ PHP function

The link_xfn_meta_box WordPress PHP function displays XFN (XHTML Friends Network) form fields for a given link object.

Usage

link_xfn_meta_box($link);

Input:

$link = (object) array(
    'link_id' => 1,
    'link_name' => 'Example Link',
    'link_url' => 'https://www.example.com'
);

Output:
XFN form fields for the link object will be displayed.

Parameters

  • $link (object) – Required. The current link object to display XFN form fields for.

More information

See WordPress Developer Resources: link_xfn_meta_box

Examples

This example shows how to display XFN form fields for a custom link object.

$link = (object) array(
    'link_id' => 1,
    'link_name' => 'Example Link',
    'link_url' => 'https://www.example.com'
);

link_xfn_meta_box($link);

This example shows how to retrieve a link object using get_link() and display its XFN form fields.

$link_id = 1;
$link = get_link($link_id);

link_xfn_meta_box($link);

This example shows how to retrieve a link object using get_link() with the URL and display its XFN form fields.

$url = 'https://www.example.com';
$link = get_link($url, OBJECT, 'url');

link_xfn_meta_box($link);

This example shows how to retrieve a link object using get_link() with the link name and display its XFN form fields.

$name = 'Example Link';
$link = get_link($name, OBJECT, 'name');

link_xfn_meta_box($link);

This example shows how to retrieve a link object using get_link() with the category and display its XFN form fields.

$category = 'example-category';
$link = get_link($category, OBJECT, 'category');

link_xfn_meta_box($link);