From 9aa0fff80efecad630b48b1b0db2a94ee82cfce7 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Wed, 22 Apr 2020 09:40:10 +0000 Subject: [PATCH] Docs: Document the default value of `$single` and `$prev_value` parameters in various metadata functions. Props denisco. See #49572. Built from https://develop.svn.wordpress.org/trunk@47610 git-svn-id: http://core.svn.wordpress.org/trunk@47385 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/comment.php | 6 +++--- wp-includes/meta.php | 2 +- wp-includes/ms-site.php | 2 +- wp-includes/post.php | 2 +- wp-includes/taxonomy.php | 6 +++--- wp-includes/user.php | 4 ++-- wp-includes/version.php | 2 +- 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/wp-includes/comment.php b/wp-includes/comment.php index 0da7d13e42..f3cdb9cc0f 100644 --- a/wp-includes/comment.php +++ b/wp-includes/comment.php @@ -450,7 +450,7 @@ function get_comment_count( $post_id = 0 ) { * @param int $comment_id Comment ID. * @param string $meta_key Metadata name. * @param mixed $meta_value Metadata value. - * @param bool $unique Optional, default is false. Whether the same key should not be added. + * @param bool $unique Optional. Whether the same key should not be added. Default false. * @return int|bool Meta ID on success, false on failure. */ function add_comment_meta( $comment_id, $meta_key, $meta_value, $unique = false ) { @@ -484,7 +484,7 @@ function delete_comment_meta( $comment_id, $meta_key, $meta_value = '' ) { * * @param int $comment_id Comment ID. * @param string $key Optional. The meta key to retrieve. By default, returns data for all keys. - * @param bool $single Whether to return a single value. + * @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. */ @@ -506,7 +506,7 @@ function get_comment_meta( $comment_id, $key = '', $single = false ) { * @param int $comment_id Comment ID. * @param string $meta_key Metadata key. * @param mixed $meta_value Metadata value. - * @param mixed $prev_value Optional. Previous value to check before removing. + * @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_comment_meta( $comment_id, $meta_key, $meta_value, $prev_value = '' ) { diff --git a/wp-includes/meta.php b/wp-includes/meta.php index 99df89697f..73f253a840 100644 --- a/wp-includes/meta.php +++ b/wp-includes/meta.php @@ -149,7 +149,7 @@ function add_metadata( $meta_type, $object_id, $meta_key, $meta_value, $unique = * @param string $meta_key Metadata key. * @param mixed $meta_value Metadata value. Must be serializable if non-scalar. * @param mixed $prev_value Optional. If specified, only update existing metadata entries - * with this value. Otherwise, update all entries. + * with this value. Otherwise, update all entries. Default empty. * @return int|bool The new meta field ID if a field with the given key didn't exist and was * therefore added, true on successful update, false on failure. */ diff --git a/wp-includes/ms-site.php b/wp-includes/ms-site.php index 186237430e..947f0e0301 100644 --- a/wp-includes/ms-site.php +++ b/wp-includes/ms-site.php @@ -1096,7 +1096,7 @@ function get_site_meta( $site_id, $key = '', $single = false ) { * @param int $site_id Site ID. * @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 removing. + * @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. diff --git a/wp-includes/post.php b/wp-includes/post.php index 2f547a4cf9..262f986221 100644 --- a/wp-includes/post.php +++ b/wp-includes/post.php @@ -2136,7 +2136,7 @@ function get_post_meta( $post_id, $key = '', $single = false ) { * @param int $post_id Post ID. * @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. + * @param mixed $prev_value Optional. Previous value to check before updating. Default empty. * @return int|bool The new meta field ID if a field with the given key didn't exist and was * therefore added, true on successful update, false on failure. */ diff --git a/wp-includes/taxonomy.php b/wp-includes/taxonomy.php index abb92f2e93..0d257c0e7f 100644 --- a/wp-includes/taxonomy.php +++ b/wp-includes/taxonomy.php @@ -1246,8 +1246,8 @@ function delete_term_meta( $term_id, $meta_key, $meta_value = '' ) { * * @param int $term_id Term ID. * @param string $key Optional. The meta key to retrieve. If no key is provided, fetches all metadata for the term. - * @param bool $single Whether to return a single value. If false, an array of all values matching the - * `$term_id`/`$key` pair will be returned. Default: false. + * @param bool $single Optional. Whether to return a single value. If false, an array of all values matching the + * `$term_id`/`$key` pair will be returned. Default false. * @return mixed If `$single` is false, an array of metadata values. If `$single` is true, a single metadata value. */ function get_term_meta( $term_id, $key = '', $single = false ) { @@ -1266,7 +1266,7 @@ function get_term_meta( $term_id, $key = '', $single = false ) { * @param int $term_id Term ID. * @param string $meta_key Metadata key. * @param mixed $meta_value Metadata value. - * @param mixed $prev_value Optional. Previous value to check before removing. + * @param mixed $prev_value Optional. Previous value to check before updating. Default empty. * @return int|WP_Error|bool Meta ID if the key didn't previously exist. True on successful update. * WP_Error when term_id is ambiguous between taxonomies. False on failure. */ diff --git a/wp-includes/user.php b/wp-includes/user.php index 6c6f87eced..2223e7a40e 100644 --- a/wp-includes/user.php +++ b/wp-includes/user.php @@ -821,7 +821,7 @@ function delete_user_meta( $user_id, $meta_key, $meta_value = '' ) { * * @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 Whether to return a single value. + * @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. */ function get_user_meta( $user_id, $key = '', $single = false ) { @@ -842,7 +842,7 @@ 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 removing. + * @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 = '' ) { diff --git a/wp-includes/version.php b/wp-includes/version.php index 466e6cf811..b814c6c17d 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.5-alpha-47609'; +$wp_version = '5.5-alpha-47610'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.