add_comment_meta

函式
add_comment_meta ( $comment_id, $meta_key, $meta_value, $unique = false )
引數
  • (int) $comment_id Comment ID.
    Required:
  • (string) $meta_key Metadata name.
    Required:
  • (mixed) $meta_value Metadata value. Must be serializable if non-scalar.
    Required:
  • (bool) $unique Optional. Whether the same key should not be added. Default false.
    Required:
    Default: false
返回值
  • (int|false) Meta ID on success, false on failure.
定義位置
相關方法
get_comment_metaupdate_comment_metadelete_comment_metaadd_comments_pageadd_post_meta
引入
2.9.0
棄用
-

add_comment_meta: 這個函式為評論新增一個自定義的後設資料: 該函式需要三個引數:評論ID,元鍵,和元值: 這個函式可以用來儲存關於評論的自定義資訊,如評級、評論或任何其他相關資訊。

在評論中新增後設資料欄位。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
function add_comment_meta( $comment_id, $meta_key, $meta_value, $unique = false ) {
return add_metadata( 'comment', $comment_id, $meta_key, $meta_value, $unique );
}
function add_comment_meta( $comment_id, $meta_key, $meta_value, $unique = false ) { return add_metadata( 'comment', $comment_id, $meta_key, $meta_value, $unique ); }
function add_comment_meta( $comment_id, $meta_key, $meta_value, $unique = false ) {
	return add_metadata( 'comment', $comment_id, $meta_key, $meta_value, $unique );
}

常見問題

FAQs
檢視更多 >