首页 WordPress函数大全 add_metadata()

add_metadata()

2020-05-02 / 3209阅 / 悠然

如何你看完本文还不知道如何使用该函数,可以联系我定制视频教程,50元/个函数,学不会全额退款

add_metadata( string $meta_type, int $object_id, string $meta_key, mixed $meta_value, bool $unique = false )

添加指定对象的元数据。

描述

参数

$meta_type

(string)
(Required)
Type of object metadata is for. Accepts 'post', 'comment', 'term', 'user', or any other object type with an associated meta table.

$object_id

(int)
(Required)
ID of the object metadata is for.

$meta_key

(string)
(Required)
Metadata key.

$meta_value

(mixed)
(Required)
Metadata value. Must be serializable if non-scalar.

$unique

(bool)
(Optional)
Whether the specified metadata key should be unique for the object. If true, and the object already has a value for the specified metadata key, no change will be made.

Default value: false

返回

(int|false) The meta ID on success, false on failure.

大家谈论
    我的见解