get_bookmark_field

Advertisement

Summery Summery

Retrieve single bookmark data item or field.

Syntax Syntax

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

Parameters 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'

Return Return

(string|WP_Error)

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

Advertisement

Changelog Changelog

Changelog
Version Description
2.3.0 Introduced.

Advertisement

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.