首页 WordPress函数大全 add_post_meta()

add_post_meta()

2020-05-01 / 3975阅 / 悠然

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

add_post_meta( int $post_id, string $meta_key, mixed $meta_value, bool $unique = false )

Adds a meta field to the given post.

描述

Post meta data is called "Custom Fields">

参数

$post_id

(int)
(Required)
Post ID.

$meta_key

(string)
(Required)
Metadata name.

$meta_value

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

$unique

(bool)
(Optional)
Whether the same key should not be added.

Default value: false

返回

(int|false) Meta ID on success, false on failure.

大家谈论
    我的见解