Meta: Reorder the get_metadata_default() signature to match get_metadata().

The order of parameters in `get_metadata_default()` did not match the signature of `get_metadata()`. This could be confusing for developers who are familiar with the existing metadata API.

Fixes #43941.
Props SergeyBiryukov, spacedmonkey, johnjamesjacoby.

Built from https://develop.svn.wordpress.org/trunk@48502


git-svn-id: http://core.svn.wordpress.org/trunk@48264 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
TimothyBlynJacobs 2020-07-17 02:59:08 +00:00
parent 265574802b
commit f7268adfbf
2 changed files with 6 additions and 5 deletions

View File

@ -508,7 +508,7 @@ function get_metadata( $meta_type, $object_id, $meta_key = '', $single = false )
return $value; return $value;
} }
return get_metadata_default( $meta_type, $meta_key, $single, $object_id ); return get_metadata_default( $meta_type, $object_id, $meta_key, $single );
} }
/** /**
@ -595,13 +595,14 @@ function get_metadata_raw( $meta_type, $object_id, $meta_key = '', $single = fal
* *
* @param string $meta_type Type of object metadata is for. Accepts 'post', 'comment', 'term', 'user', * @param string $meta_type Type of object metadata is for. Accepts 'post', 'comment', 'term', 'user',
* or any other object type with an associated meta table. * or any other object type with an associated meta table.
* @param string $meta_key Metadata key. * @param int $object_id ID of the object metadata is for.
* @param string $meta_key Metadata key. If not specified, retrieve all metadata for
* the specified object. Default empty.
* @param bool $single Optional. If true, return only the first value of the specified meta_key. * @param bool $single Optional. If true, return only the first value of the specified meta_key.
* This parameter has no effect if meta_key is not specified. Default false. * This parameter has no effect if meta_key is not specified. Default false.
* @param int $object_id Optional. ID of the object metadata is for. Default 0.
* @return mixed Single metadata value, or array of values. * @return mixed Single metadata value, or array of values.
*/ */
function get_metadata_default( $meta_type, $meta_key, $single = false, $object_id = 0 ) { function get_metadata_default( $meta_type, $object_id, $meta_key, $single = false ) {
if ( $single ) { if ( $single ) {
$value = ''; $value = '';
} else { } else {

View File

@ -13,7 +13,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '5.5-beta2-48501'; $wp_version = '5.5-beta2-48502';
/** /**
* 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.