Title: get_bookmark_field
Published: April 25, 2014
Last modified: May 20, 2026

---

# get_bookmark_field( string $field, int $bookmark, string $context = 'display' ): string|󠀁[WP_Error](https://developer.wordpress.org/reference/classes/wp_error/)󠁿

## In this article

 * [Parameters](https://developer.wordpress.org/reference/functions/get_bookmark_field/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/functions/get_bookmark_field/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/functions/get_bookmark_field/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/functions/get_bookmark_field/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/get_bookmark_field/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/functions/get_bookmark_field/?output_format=md#wp--skip-link--target)

Retrieves single bookmark data item or field.

## 󠀁[Parameters](https://developer.wordpress.org/reference/functions/get_bookmark_field/?output_format=md#parameters)󠁿

 `$field`stringrequired

The name of the data field to return.

`$bookmark`intrequired

The bookmark ID to get field.

`$context`stringoptional

The context of how the field will be used. Default `'display'`.

Default:`'display'`

## 󠀁[Return](https://developer.wordpress.org/reference/functions/get_bookmark_field/?output_format=md#return)󠁿

 string|[WP_Error](https://developer.wordpress.org/reference/classes/wp_error/)

## 󠀁[Source](https://developer.wordpress.org/reference/functions/get_bookmark_field/?output_format=md#source)󠁿

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

[View all references](https://developer.wordpress.org/reference/files/wp-includes/bookmark.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.0/src/wp-includes/bookmark.php#L78)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-includes/bookmark.php#L78-L95)

## 󠀁[Related](https://developer.wordpress.org/reference/functions/get_bookmark_field/?output_format=md#related)󠁿

| Uses | Description | 
| [sanitize_bookmark_field()](https://developer.wordpress.org/reference/functions/sanitize_bookmark_field/)`wp-includes/bookmark.php` |

Sanitizes a bookmark field.

  | 
| [get_bookmark()](https://developer.wordpress.org/reference/functions/get_bookmark/)`wp-includes/bookmark.php` |

Retrieves bookmark data.

  | 
| [is_wp_error()](https://developer.wordpress.org/reference/functions/is_wp_error/)`wp-includes/load.php` |

Checks whether the given variable is a WordPress Error.

  |

[Show 1 more](https://developer.wordpress.org/reference/functions/get_bookmark_field/?output_format=md#)
[Show less](https://developer.wordpress.org/reference/functions/get_bookmark_field/?output_format=md#)

## 󠀁[Changelog](https://developer.wordpress.org/reference/functions/get_bookmark_field/?output_format=md#changelog)󠁿

| Version | Description | 
| [2.3.0](https://developer.wordpress.org/reference/since/2.3.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fget_bookmark_field%2F)
before being able to contribute a note or feedback.