Using WordPress ‘link_advanced_meta_box()’ PHP function

The link_advanced_meta_box WordPress PHP function displays advanced link options form fields.

Usage

link_advanced_meta_box( $link );

Example:

Input:

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

Output:

Advanced link options form fields for the link with ID 1.

Parameters

  • $link (object) – Required. The current link object.

More information

See WordPress Developer Resources: link_advanced_meta_box

Examples

This example displays the advanced options form fields for the link with the ID 1.

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

This example loops through all links and displays the advanced options form fields for each link.

$links = get_bookmarks();
foreach ($links as $link) {
    link_advanced_meta_box($link);
}

This example retrieves all links in the category with the slug ‘resources’ and displays the advanced options form fields for each link.

$args = array(
    'category_name' => 'resources',
);
$links = get_bookmarks($args);
foreach ($links as $link) {
    link_advanced_meta_box($link);
}

This example retrieves all links with the target ‘_blank’ and displays the advanced options form fields for each link.

$args = array(
    'link_target' => '_blank',
);
$links = get_bookmarks($args);
foreach ($links as $link) {
    link_advanced_meta_box($link);
}

This example retrieves all links with a custom attribute ‘data-custom’ and displays the advanced options form fields for each link.

$args = array(
    'meta_key' => 'data-custom',
);
$links = get_bookmarks($args);
foreach ($links as $link) {
    link_advanced_meta_box($link);
}