get_bookmark_field

The timeline below displays how wordpress function get_bookmark_field has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 6.2

/**
 * Retrieves single bookmark data item or field.
 *
 * @since 2.3.0
 *
 * @param string $field    The name of the data field to return.
 * @param int    $bookmark The bookmark ID to get field.
 * @param string $context  Optional. The context of how the field will be used. Default 'display'.
 * @return string|WP_Error
 */
function get_bookmark_field($field, $bookmark, $context = 'display')
{
    $bookmark = (int) $bookmark;
    $bookmark = get_bookmark($bookmark);
    if (is_wp_error($bookmark)) {
        return $bookmark;
    }
    if (!is_object($bookmark)) {
        return '';
    }
    if (!isset($bookmark->{$field})) {
        return '';
    }
    return sanitize_bookmark_field($field, $bookmark->{$field}, $bookmark->link_id, $context);
}

WordPress Version: 6.1

/**
 * Retrieves single bookmark data item or field.
 *
 * @since 2.3.0
 *
 * @param string $field    The name of the data field to return.
 * @param int    $bookmark The bookmark ID to get field.
 * @param string $context  Optional. The context of how the field will be used.
 * @return string|WP_Error
 */
function get_bookmark_field($field, $bookmark, $context = 'display')
{
    $bookmark = (int) $bookmark;
    $bookmark = get_bookmark($bookmark);
    if (is_wp_error($bookmark)) {
        return $bookmark;
    }
    if (!is_object($bookmark)) {
        return '';
    }
    if (!isset($bookmark->{$field})) {
        return '';
    }
    return sanitize_bookmark_field($field, $bookmark->{$field}, $bookmark->link_id, $context);
}

WordPress Version: 5.5

/**
 * Retrieve single bookmark data item or field.
 *
 * @since 2.3.0
 *
 * @param string $field    The name of the data field to return.
 * @param int    $bookmark The bookmark ID to get field.
 * @param string $context  Optional. The context of how the field will be used.
 * @return string|WP_Error
 */
function get_bookmark_field($field, $bookmark, $context = 'display')
{
    $bookmark = (int) $bookmark;
    $bookmark = get_bookmark($bookmark);
    if (is_wp_error($bookmark)) {
        return $bookmark;
    }
    if (!is_object($bookmark)) {
        return '';
    }
    if (!isset($bookmark->{$field})) {
        return '';
    }
    return sanitize_bookmark_field($field, $bookmark->{$field}, $bookmark->link_id, $context);
}

WordPress Version: 4.3

/**
 * Retrieve single bookmark data item or field.
 *
 * @since 2.3.0
 *
 * @param string $field The name of the data field to return
 * @param int $bookmark The bookmark ID to get field
 * @param string $context Optional. The context of how the field will be used.
 * @return string|WP_Error
 */
function get_bookmark_field($field, $bookmark, $context = 'display')
{
    $bookmark = (int) $bookmark;
    $bookmark = get_bookmark($bookmark);
    if (is_wp_error($bookmark)) {
        return $bookmark;
    }
    if (!is_object($bookmark)) {
        return '';
    }
    if (!isset($bookmark->{$field})) {
        return '';
    }
    return sanitize_bookmark_field($field, $bookmark->{$field}, $bookmark->link_id, $context);
}

WordPress Version: 4.1

/**
 * Retrieve single bookmark data item or field.
 *
 * @since 2.3.0
 *
 * @param string $field The name of the data field to return
 * @param int $bookmark The bookmark ID to get field
 * @param string $context Optional. The context of how the field will be used.
 * @return string
 */
function get_bookmark_field($field, $bookmark, $context = 'display')
{
    $bookmark = (int) $bookmark;
    $bookmark = get_bookmark($bookmark);
    if (is_wp_error($bookmark)) {
        return $bookmark;
    }
    if (!is_object($bookmark)) {
        return '';
    }
    if (!isset($bookmark->{$field})) {
        return '';
    }
    return sanitize_bookmark_field($field, $bookmark->{$field}, $bookmark->link_id, $context);
}

WordPress Version: 3.7

/**
 * Retrieve single bookmark data item or field.
 *
 * @since 2.3.0
 * @uses get_bookmark() Gets bookmark object using $bookmark as ID
 * @uses sanitize_bookmark_field() Sanitizes Bookmark field based on $context.
 *
 * @param string $field The name of the data field to return
 * @param int $bookmark The bookmark ID to get field
 * @param string $context Optional. The context of how the field will be used.
 * @return string
 */
function get_bookmark_field($field, $bookmark, $context = 'display')
{
    $bookmark = (int) $bookmark;
    $bookmark = get_bookmark($bookmark);
    if (is_wp_error($bookmark)) {
        return $bookmark;
    }
    if (!is_object($bookmark)) {
        return '';
    }
    if (!isset($bookmark->{$field})) {
        return '';
    }
    return sanitize_bookmark_field($field, $bookmark->{$field}, $bookmark->link_id, $context);
}