A WordPress-centric search engine for devs and theme authors



get_bookmark_field ›

Since2.3.0
Deprecatedn/a
get_bookmark_field ( $field, $bookmark, $context = 'display' )
Parameters: (3)
  • (string) $field The name of the data field to return
    Required: Yes
  • (int) $bookmark The bookmark ID to get field
    Required: Yes
  • (string) $context Optional. The context of how the field will be used.
    Required: No
    Default: 'display'
Returns:
  • (string|WP_Error)
Defined at:
Codex:

Retrieve single bookmark data item or field.



Source

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