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
This commit is contained in:
Sergey Biryukov 2020-04-22 09:40:10 +00:00
parent 29abe5c726
commit 9aa0fff80e
7 changed files with 12 additions and 12 deletions

View File

@ -450,7 +450,7 @@ function get_comment_count( $post_id = 0 ) {
* @param int $comment_id Comment ID. * @param int $comment_id Comment ID.
* @param string $meta_key Metadata name. * @param string $meta_key Metadata name.
* @param mixed $meta_value Metadata value. * @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. * @return int|bool Meta ID on success, false on failure.
*/ */
function add_comment_meta( $comment_id, $meta_key, $meta_value, $unique = false ) { 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 int $comment_id Comment ID.
* @param string $key Optional. The meta key to retrieve. By default, returns data for all keys. * @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 * @return mixed Will be an array if $single is false. Will be value of meta data field if $single
* is true. * is true.
*/ */
@ -506,7 +506,7 @@ function get_comment_meta( $comment_id, $key = '', $single = false ) {
* @param int $comment_id Comment ID. * @param int $comment_id Comment ID.
* @param string $meta_key Metadata key. * @param string $meta_key Metadata key.
* @param mixed $meta_value Metadata value. * @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. * @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 = '' ) { function update_comment_meta( $comment_id, $meta_key, $meta_value, $prev_value = '' ) {

View File

@ -149,7 +149,7 @@ function add_metadata( $meta_type, $object_id, $meta_key, $meta_value, $unique =
* @param string $meta_key Metadata key. * @param string $meta_key Metadata key.
* @param mixed $meta_value Metadata value. Must be serializable if non-scalar. * @param mixed $meta_value Metadata value. Must be serializable if non-scalar.
* @param mixed $prev_value Optional. If specified, only update existing metadata entries * @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 * @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. * therefore added, true on successful update, false on failure.
*/ */

View File

@ -1096,7 +1096,7 @@ function get_site_meta( $site_id, $key = '', $single = false ) {
* @param int $site_id Site ID. * @param int $site_id Site ID.
* @param string $meta_key Metadata key. * @param string $meta_key Metadata key.
* @param mixed $meta_value Metadata value. Must be serializable if non-scalar. * @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. * Default empty.
* @return int|bool Meta ID if the key didn't exist, true on successful update, * @return int|bool Meta ID if the key didn't exist, true on successful update,
* false on failure. * false on failure.

View File

@ -2136,7 +2136,7 @@ function get_post_meta( $post_id, $key = '', $single = false ) {
* @param int $post_id Post ID. * @param int $post_id Post ID.
* @param string $meta_key Metadata key. * @param string $meta_key Metadata key.
* @param mixed $meta_value Metadata value. Must be serializable if non-scalar. * @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 * @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. * therefore added, true on successful update, false on failure.
*/ */

View File

@ -1246,8 +1246,8 @@ function delete_term_meta( $term_id, $meta_key, $meta_value = '' ) {
* *
* @param int $term_id Term ID. * @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 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 * @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. * `$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. * @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 ) { 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 int $term_id Term ID.
* @param string $meta_key Metadata key. * @param string $meta_key Metadata key.
* @param mixed $meta_value Metadata value. * @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. * @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. * WP_Error when term_id is ambiguous between taxonomies. False on failure.
*/ */

View File

@ -821,7 +821,7 @@ function delete_user_meta( $user_id, $meta_key, $meta_value = '' ) {
* *
* @param int $user_id User ID. * @param int $user_id User ID.
* @param string $key Optional. The meta key to retrieve. By default, returns data for all keys. * @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. * @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 ) { 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 int $user_id User ID.
* @param string $meta_key Metadata key. * @param string $meta_key Metadata key.
* @param mixed $meta_value Metadata value. * @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. * @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 = '' ) { function update_user_meta( $user_id, $meta_key, $meta_value, $prev_value = '' ) {

View File

@ -13,7 +13,7 @@
* *
* @global string $wp_version * @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. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.