函数原型
get_bookmark_field( string $field, int $bookmark, string $context = ‘display’ ): string|WP_Error
函数描述
Retrieves single bookmark data item or field.
是否弃用
未弃用
函数参数
-
$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:
'display'
函数返回值
string|WP_Error
函数位置
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 );
}
源码链接
变更日志
| Version | Description |
|---|---|
| 2.3.0 | Introduced. |

