Docs: Synchronize parameter documentation for various metadata functions, update per the documentation standards.

See #49572.

git-svn-id: https://develop.svn.wordpress.org/trunk@47611 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov
2020-04-22 10:29:34 +00:00
parent b6391847b4
commit 3659b767f1
8 changed files with 97 additions and 67 deletions

View File

@@ -786,8 +786,9 @@ function is_user_member_of_blog( $user_id = 0, $blog_id = 0 ) {
*
* @param int $user_id User ID.
* @param string $meta_key Metadata name.
* @param mixed $meta_value Metadata value.
* @param bool $unique Optional. Whether the same key should not be added. Default false.
* @param mixed $meta_value Metadata value. Must be serializable if non-scalar.
* @param bool $unique Optional. Whether the same key should not be added.
* Default false.
* @return int|false Meta ID on success, false on failure.
*/
function add_user_meta( $user_id, $meta_key, $meta_value, $unique = false ) {
@@ -806,7 +807,9 @@ function add_user_meta( $user_id, $meta_key, $meta_value, $unique = false ) {
*
* @param int $user_id User ID
* @param string $meta_key Metadata name.
* @param mixed $meta_value Optional. Metadata value.
* @param mixed $meta_value Optional. Metadata value. If provided,
* rows will only be removed that match the value.
* Must be serializable if non-scalar. Default empty.
* @return bool True on success, false on failure.
*/
function delete_user_meta( $user_id, $meta_key, $meta_value = '' ) {
@@ -820,9 +823,13 @@ function delete_user_meta( $user_id, $meta_key, $meta_value = '' ) {
* @link https://developer.wordpress.org/reference/functions/get_user_meta/
*
* @param int $user_id User ID.
* @param string $key Optional. The meta key to retrieve. By default, returns data for all keys.
* @param bool $single Optional. Whether to return a single value. Default false.
* @return mixed Will be an array if $single is false. Will be value of meta data field if $single is true.
* @param string $key Optional. The meta key to retrieve. By default,
* returns data for all keys.
* @param bool $single Optional. Whether to return a single value.
* This parameter has no effect if $key is not specified.
* Default false.
* @return mixed An array if $single is false. The value of meta data field
* if $single is true.
*/
function get_user_meta( $user_id, $key = '', $single = false ) {
return get_metadata( 'user', $user_id, $key, $single );
@@ -841,9 +848,11 @@ function get_user_meta( $user_id, $key = '', $single = false ) {
*
* @param int $user_id User ID.
* @param string $meta_key Metadata key.
* @param mixed $meta_value Metadata value.
* @param mixed $prev_value Optional. Previous value to check before updating. Default empty.
* @return int|bool Meta ID if the key didn't exist, true on successful update, false on failure.
* @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.
* @return int|bool Meta ID if the key didn't exist, true on successful update,
* false on failure.
*/
function update_user_meta( $user_id, $meta_key, $meta_value, $prev_value = '' ) {
return update_metadata( 'user', $user_id, $meta_key, $meta_value, $prev_value );