Skip to content

Commit 89c3141

Browse files
committed
Update site meta functions
1 parent 62445c0 commit 89c3141

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/wp-includes/ms-site.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1026,7 +1026,13 @@ function clean_blog_cache( $blog ) {
10261026
*
10271027
* @param int $site_id Site ID.
10281028
* @param string $meta_key Metadata name.
1029-
* @param mixed $meta_value Metadata value. Must be serializable if non-scalar.
1029+
* @param mixed $meta_value Metadata value. Arrays and objects are stored as serialized data and
1030+
* will be returned as the same type when retrieved. Other data types will
1031+
* be stored as strings in the database:
1032+
* - false is stored and retrieved as an empty string ('')
1033+
* - true is stored and retrieved as '1'
1034+
* - numbers (both integer and float) are stored and retrieved as strings
1035+
* Must be serializable if non-scalar.
10301036
* @param bool $unique Optional. Whether the same key should not be added.
10311037
* Default false.
10321038
* @return int|false Meta ID on success, false on failure.
@@ -1071,6 +1077,11 @@ function delete_site_meta( $site_id, $meta_key, $meta_value = '' ) {
10711077
* False for an invalid `$site_id` (non-numeric, zero, or negative value).
10721078
* An empty array if a valid but non-existing site ID is passed and `$single` is false.
10731079
* An empty string if a valid but non-existing site ID is passed and `$single` is true.
1080+
* Note: Non-serialized values are returned as strings:
1081+
* - false values are returned as empty strings ('')
1082+
* - true values are returned as '1'
1083+
* - numbers (both integer and float) are returned as strings
1084+
* Arrays and objects retain their original type.
10741085
*/
10751086
function get_site_meta( $site_id, $key = '', $single = false ) {
10761087
return get_metadata( 'blog', $site_id, $key, $single );

0 commit comments

Comments
 (0)