get_bookmark_field() WordPress Function

The get_bookmark_field() function is used to get a field from a bookmark.

get_bookmark_field( string $field, int $bookmark, string $context = 'display' ) #

Retrieve single bookmark data item or field.


Parameters

$field

(string)(Required)The name of the data field to return.

$bookmark

(int)(Required)The bookmark ID to get field.

$context

(string)(Optional) The context of how the field will be used.

Default value: 'display'


Top ↑

Return

(string|WP_Error)


Top ↑

Source

File: wp-includes/bookmark.php

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 );
}


Top ↑

Changelog

Changelog
VersionDescription
2.3.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.