get_bookmark_field() - WordPress 函数参考中文文档

返回介绍

get_bookmark_field()

发布于 2017-09-10 字数 1684 浏览 893 评论 0

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

Retrieve 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 value: ‘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 描述
2.3.0 Introduced.

相关函数

Uses

  • wp-includes/bookmark.php:
    sanitize_bookmark_field()
  • wp-includes/bookmark.php:
    get_bookmark()
  • wp-includes/load.php:
    is_wp_error()

User Contributed Notes

上一篇:get_bookmarks()

下一篇:get_boundary_post()

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

目前还没有任何评论,快来抢沙发吧!