update_comment_meta

函式
update_comment_meta ( $comment_id, $meta_key, $meta_value, $prev_value = '' )
引數
  • (int) $comment_id Comment ID.
    Required:
  • (string) $meta_key Metadata key.
    Required:
  • (mixed) $meta_value Metadata value. Must be serializable if non-scalar.
    Required:
  • (mixed) $prev_value Optional. Previous value to check before updating. If specified, only update existing metadata entries with this value. Otherwise, update all entries. Default empty.
    Required:
    Default: (empty)
返回值
  • (int|bool) Meta ID if the key didn't exist, true on successful update, false on failure or if the value passed to the function is the same as the one that is already in the database.
定義位置
相關方法
delete_comment_metaupdate_comment_cacheupdate_post_metaget_comment_metaadd_comment_meta
引入
2.9.0
棄用
-

update_comment_meta: 這個函式更新一個評論的後設資料。它需要三個引數:評論ID,元金鑰,和元值。

根據評論ID更新評論元域。

使用$prev_value引數來區分具有相同鍵和評論ID的元欄位。

如果該評論的元欄位不存在,它將被新增。

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

常見問題

FAQs
檢視更多 >