Docs: Improve documentation for the $prev_value parameter and return result of various metadata update functions.

Props stevenlinx.
Fixes #50502. See #49572.

git-svn-id: https://develop.svn.wordpress.org/trunk@48214 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov
2020-06-29 21:20:11 +00:00
parent df8af186de
commit dc3c92d08f
6 changed files with 32 additions and 17 deletions

View File

@@ -517,9 +517,11 @@ function get_comment_meta( $comment_id, $key = '', $single = false ) {
* @param string $meta_key Metadata key.
* @param mixed $meta_value Metadata value. Must be serializable if non-scalar.
* @param mixed $prev_value Optional. Previous value to check before updating.
* Default empty.
* If specified, only update existing metadata entries with
* this value. Otherwise, update all entries. Default empty.
* @return int|bool Meta ID if the key didn't exist, true on successful update,
* false on failure.
* false on failure or if the value passed to the function
* is the same as the one that is already in the database.
*/
function update_comment_meta( $comment_id, $meta_key, $meta_value, $prev_value = '' ) {
return update_metadata( 'comment', $comment_id, $meta_key, $meta_value, $prev_value );