<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[47390] trunk/src/wp-includes/meta.php: Docs: Improve documentation for various metadata functions.</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { white-space: pre-line; overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="https://core.trac.wordpress.org/changeset/47390">47390</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"https://core.trac.wordpress.org/changeset/47390","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>SergeyBiryukov</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2020-02-28 12:12:58 +0000 (Fri, 28 Feb 2020)</dd>
</dl>
<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>Docs: Improve documentation for various metadata functions.
This adds a more specific description for accepted object types: `post`, `comment`, `term`, `user`, or any other object type with an associated meta table.
Props sheparddw, kraftbj, DrewAPicture, SergeyBiryukov.
Fixes <a href="https://core.trac.wordpress.org/ticket/45464">#45464</a>.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpincludesmetaphp">trunk/src/wp-includes/meta.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpincludesmetaphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/meta.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/meta.php 2020-02-28 01:38:58 UTC (rev 47389)
+++ trunk/src/wp-includes/meta.php 2020-02-28 12:12:58 UTC (rev 47390)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -11,20 +11,20 @@
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Add metadata for the specified object.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Adds metadata for the specified object.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 2.9.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @global wpdb $wpdb WordPress database abstraction object.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $meta_type Type of object metadata is for (e.g., comment, post, term, or user).
- * @param int $object_id ID of the object metadata is for
- * @param string $meta_key Metadata key
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @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.
+ * @param int $object_id ID of the object metadata is for.
+ * @param string $meta_key Metadata key.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @param mixed $meta_value Metadata value. Must be serializable if non-scalar.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param bool $unique Optional, default is false.
- * Whether the specified metadata key should be unique for the object.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param bool $unique Optional. Whether the specified metadata key should be unique for the object.
</ins><span class="cx" style="display: block; padding: 0 10px"> * If true, and the object already has a value for the specified metadata key,
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * no change will be made.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * no change will be made. Default false.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @return int|false The meta ID on success, false on failure.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function add_metadata( $meta_type, $object_id, $meta_key, $meta_value, $unique = false ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -63,11 +63,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 3.1.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @param null|bool $check Whether to allow adding metadata for the given type.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param int $object_id Object ID.
- * @param string $meta_key Meta key.
- * @param mixed $meta_value Meta value. Must be serializable if non-scalar.
- * @param bool $unique Whether the specified meta key should be unique
- * for the object. Optional. Default false.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param int $object_id ID of the object metadata is for.
+ * @param string $meta_key Metadata key.
+ * @param mixed $meta_value Metadata value. Must be serializable if non-scalar.
+ * @param bool $unique Whether the specified meta key should be unique for the object.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> $check = apply_filters( "add_{$meta_type}_metadata", null, $object_id, $meta_key, $meta_value, $unique );
</span><span class="cx" style="display: block; padding: 0 10px"> if ( null !== $check ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -95,9 +94,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 3.1.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param int $object_id Object ID.
- * @param string $meta_key Meta key.
- * @param mixed $_meta_value Meta value.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param int $object_id ID of the object metadata is for.
+ * @param string $meta_key Metadata key.
+ * @param mixed $_meta_value Metadata value. Serialized if non-scalar.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> do_action( "add_{$meta_type}_meta", $object_id, $meta_key, $_meta_value );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -127,9 +126,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 2.9.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @param int $mid The meta ID after successful update.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param int $object_id Object ID.
- * @param string $meta_key Meta key.
- * @param mixed $_meta_value Meta value.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param int $object_id ID of the object metadata is for.
+ * @param string $meta_key Metadata key.
+ * @param mixed $_meta_value Metadata value. Serialized if non-scalar.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> do_action( "added_{$meta_type}_meta", $mid, $object_id, $meta_key, $_meta_value );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -137,7 +136,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Update metadata for the specified object. If no value already exists for the specified object
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Updates metadata for the specified object. If no value already exists for the specified object
</ins><span class="cx" style="display: block; padding: 0 10px"> * ID and metadata key, the metadata will be added.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 2.9.0
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -144,12 +143,13 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @global wpdb $wpdb WordPress database abstraction object.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $meta_type Type of object metadata is for (e.g., comment, post, term, or user).
- * @param int $object_id ID of the object metadata is for
- * @param string $meta_key Metadata key
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @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.
+ * @param int $object_id ID of the object metadata is for.
+ * @param string $meta_key Metadata key.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @param mixed $meta_value Metadata value. Must be serializable if non-scalar.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param mixed $prev_value Optional. If specified, only update existing metadata entries with
- * the specified value. Otherwise, update all entries.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param mixed $prev_value Optional. If specified, only update existing metadata entries
+ * with this value. Otherwise, update all entries.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @return int|bool The new meta field ID if a field with the given key didn't exist and was
</span><span class="cx" style="display: block; padding: 0 10px"> * therefore added, true on successful update, false on failure.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -192,12 +192,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 3.1.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @param null|bool $check Whether to allow updating metadata for the given type.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param int $object_id Object ID.
- * @param string $meta_key Meta key.
- * @param mixed $meta_value Meta value. Must be serializable if non-scalar.
- * @param mixed $prev_value Optional. If specified, only update existing
- * metadata entries with the specified value.
- * Otherwise, update all entries.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param int $object_id ID of the object metadata is for.
+ * @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.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> $check = apply_filters( "update_{$meta_type}_metadata", null, $object_id, $meta_key, $meta_value, $prev_value );
</span><span class="cx" style="display: block; padding: 0 10px"> if ( null !== $check ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -243,9 +242,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 2.9.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @param int $meta_id ID of the metadata entry to update.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param int $object_id Object ID.
- * @param string $meta_key Meta key.
- * @param mixed $_meta_value Meta value.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param int $object_id ID of the object metadata is for.
+ * @param string $meta_key Metadata key.
+ * @param mixed $_meta_value Metadata value. Serialized if non-scalar.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> do_action( "update_{$meta_type}_meta", $meta_id, $object_id, $meta_key, $_meta_value );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -257,9 +256,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @param int $meta_id ID of metadata entry to update.
</span><span class="cx" style="display: block; padding: 0 10px"> * @param int $object_id Post ID.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $meta_key Meta key.
- * @param mixed $meta_value Meta value. This will be a PHP-serialized string representation of the value if
- * the value is an array, an object, or itself a PHP-serialized string.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $meta_key Metadata key.
+ * @param mixed $meta_value Metadata value. This will be a PHP-serialized string representation of the value
+ * if the value is an array, an object, or itself a PHP-serialized string.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> do_action( 'update_postmeta', $meta_id, $object_id, $meta_key, $meta_value );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -282,9 +281,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 2.9.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @param int $meta_id ID of updated metadata entry.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param int $object_id Object ID.
- * @param string $meta_key Meta key.
- * @param mixed $_meta_value Meta value.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param int $object_id ID of the object metadata is for.
+ * @param string $meta_key Metadata key.
+ * @param mixed $_meta_value Metadata value. Serialized if non-scalar.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> do_action( "updated_{$meta_type}_meta", $meta_id, $object_id, $meta_key, $_meta_value );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -296,9 +295,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @param int $meta_id ID of updated metadata entry.
</span><span class="cx" style="display: block; padding: 0 10px"> * @param int $object_id Post ID.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $meta_key Meta key.
- * @param mixed $meta_value Meta value. This will be a PHP-serialized string representation of the value if
- * the value is an array, an object, or itself a PHP-serialized string.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $meta_key Metadata key.
+ * @param mixed $meta_value Metadata value. This will be a PHP-serialized string representation of the value
+ * if the value is an array, an object, or itself a PHP-serialized string.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> do_action( 'updated_postmeta', $meta_id, $object_id, $meta_key, $meta_value );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -308,23 +307,25 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Delete metadata for the specified object.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Deletes metadata for the specified object.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 2.9.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @global wpdb $wpdb WordPress database abstraction object.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $meta_type Type of object metadata is for (e.g., comment, post, term, or user).
- * @param int $object_id ID of the object metadata is for
- * @param string $meta_key Metadata key
- * @param mixed $meta_value Optional. Metadata value. Must be serializable if non-scalar. If specified, only delete
- * metadata entries with this value. Otherwise, delete all entries with the specified meta_key.
- * Pass `null`, `false`, or an empty string to skip this check. (For backward compatibility,
- * it is not possible to pass an empty string to delete those entries with an empty string
- * for a value.)
- * @param bool $delete_all Optional, default is false. If true, delete matching metadata entries for all objects,
- * ignoring the specified object_id. Otherwise, only delete matching metadata entries for
- * the specified object_id.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @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.
+ * @param int $object_id ID of the object metadata is for.
+ * @param string $meta_key Metadata key.
+ * @param mixed $meta_value Optional. Metadata value. Must be serializable if non-scalar.
+ * If specified, only delete metadata entries with this value.
+ * Otherwise, delete all entries with the specified meta_key.
+ * Pass `null`, `false`, or an empty string to skip this check.
+ * (For backward compatibility, it is not possible to pass an empty string
+ * to delete those entries with an empty string for a value.)
+ * @param bool $delete_all Optional. If true, delete matching metadata entries for all objects,
+ * ignoring the specified object_id. Otherwise, only delete
+ * matching metadata entries for the specified object_id. Default false.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @return bool True on successful delete, false on failure.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function delete_metadata( $meta_type, $object_id, $meta_key, $meta_value = '', $delete_all = false ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -360,9 +361,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 3.1.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @param null|bool $delete Whether to allow metadata deletion of the given type.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param int $object_id Object ID.
- * @param string $meta_key Meta key.
- * @param mixed $meta_value Meta value. Must be serializable if non-scalar.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param int $object_id ID of the object metadata is for.
+ * @param string $meta_key Metadata key.
+ * @param mixed $meta_value Metadata value. Must be serializable if non-scalar.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @param bool $delete_all Whether to delete the matching metadata entries
</span><span class="cx" style="display: block; padding: 0 10px"> * for all objects, ignoring the specified $object_id.
</span><span class="cx" style="display: block; padding: 0 10px"> * Default false.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -407,9 +408,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 3.1.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string[] $meta_ids An array of metadata entry IDs to delete.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param int $object_id Object ID.
- * @param string $meta_key Meta key.
- * @param mixed $_meta_value Meta value.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param int $object_id ID of the object metadata is for.
+ * @param string $meta_key Metadata key.
+ * @param mixed $_meta_value Metadata value. Serialized if non-scalar.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> do_action( "delete_{$meta_type}_meta", $meta_ids, $object_id, $meta_key, $_meta_value );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -450,9 +451,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 2.9.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string[] $meta_ids An array of metadata entry IDs to delete.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param int $object_id Object ID.
- * @param string $meta_key Meta key.
- * @param mixed $_meta_value Meta value.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param int $object_id ID of the object metadata is for.
+ * @param string $meta_key Metadata key.
+ * @param mixed $_meta_value Metadata value. Serialized if non-scalar.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> do_action( "deleted_{$meta_type}_meta", $meta_ids, $object_id, $meta_key, $_meta_value );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -472,17 +473,17 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Retrieve metadata for the specified object.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Retrieves metadata for the specified object.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 2.9.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $meta_type Type of object metadata is for (e.g., comment, post, term, or user).
- * @param int $object_id ID of the object metadata is for
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @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.
+ * @param int $object_id ID of the object metadata is for.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @param string $meta_key Optional. Metadata key. If not specified, retrieve all metadata for
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * the specified object.
- * @param bool $single Optional, default is false.
- * If true, return only the first value of the specified meta_key.
- * This parameter has no effect if meta_key is not specified.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * the specified object. Default empty.
+ * @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.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @return mixed Single metadata value, or array of values
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function get_metadata( $meta_type, $object_id, $meta_key = '', $single = false ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -506,8 +507,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @param null|array|string $value The value get_metadata() should return - a single metadata value,
</span><span class="cx" style="display: block; padding: 0 10px"> * or an array of values.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param int $object_id Object ID.
- * @param string $meta_key Meta key.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param int $object_id ID of the object metadata is for.
+ * @param string $meta_key Metadata key.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @param bool $single Whether to return only the first value of the specified $meta_key.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> $check = apply_filters( "get_{$meta_type}_metadata", null, $object_id, $meta_key, $single );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -550,12 +551,13 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Determine if a meta key is set for a given object
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Determines if a meta key is set for a given object.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 3.3.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $meta_type Type of object metadata is for (e.g., comment, post, term, or user).
- * @param int $object_id ID of the object metadata is for
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @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.
+ * @param int $object_id ID of the object metadata is for.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @param string $meta_key Metadata key.
</span><span class="cx" style="display: block; padding: 0 10px"> * @return bool True of the key is set, false if not.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -590,14 +592,15 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Get meta data by meta ID
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Retrieves metadata by meta ID.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 3.3.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @global wpdb $wpdb WordPress database abstraction object.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $meta_type Type of object metadata is for (e.g., comment, post, term, or user).
- * @param int $meta_id ID for a specific meta row
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @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.
+ * @param int $meta_id ID for a specific meta row.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @return object|false Meta object or false.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function get_metadata_by_mid( $meta_type, $meta_id ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -650,16 +653,17 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Update meta data by meta ID
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Updates metadata by meta ID.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 3.3.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @global wpdb $wpdb WordPress database abstraction object.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $meta_type Type of object metadata is for (e.g., comment, post, term, or user).
- * @param int $meta_id ID for a specific meta row
- * @param string $meta_value Metadata value
- * @param string $meta_key Optional, you can provide a meta key to update it
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @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.
+ * @param int $meta_id ID for a specific meta row.
+ * @param string $meta_value Metadata value.
+ * @param string $meta_key Optional. You can provide a meta key to update it. Default false.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @return bool True on successful update, false on failure.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function update_metadata_by_mid( $meta_type, $meta_id, $meta_value, $meta_key = false ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -766,14 +770,15 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Delete meta data by meta ID
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Deletes metadata by meta ID.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 3.3.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @global wpdb $wpdb WordPress database abstraction object.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $meta_type Type of object metadata is for (e.g., comment, post, term, or user).
- * @param int $meta_id ID for a specific meta row
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @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.
+ * @param int $meta_id ID for a specific meta row.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @return bool True on successful delete, false on failure.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function delete_metadata_by_mid( $meta_type, $meta_id ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -871,13 +876,14 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Update the metadata cache for the specified objects.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Updates the metadata cache for the specified objects.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 2.9.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @global wpdb $wpdb WordPress database abstraction object.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $meta_type Type of object metadata is for (e.g., comment, post, term, or user).
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @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.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @param string|int[] $object_ids Array or comma delimited list of object IDs to update cache for.
</span><span class="cx" style="display: block; padding: 0 10px"> * @return array|false Metadata cache for the specified objects, or false on failure.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1006,13 +1012,14 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Retrieve the name of the metadata table for the specified object type.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Retrieves the name of the metadata table for the specified object type.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 2.9.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @global wpdb $wpdb WordPress database abstraction object.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $type Type of object to get metadata table for (e.g., comment, post, term, or user).
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $type Type of object metadata is for. Accepts 'post', 'comment', 'term', 'user',
+ * or any other object type with an associated meta table.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @return string|false Metadata table name, or false if no metadata table exists
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function _get_meta_table( $type ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1032,11 +1039,12 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 3.1.3
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $meta_key Meta key.
- * @param string|null $meta_type Optional. Type of object metadata is for (e.g., comment, post, term, or user).
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $meta_key Metadata key.
+ * @param string $meta_type Optional. Type of object metadata is for. Accepts 'post', 'comment', 'term', 'user',
+ * or any other object type with an associated meta table. Default empty.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @return bool Whether the meta key is considered protected.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-function is_protected_meta( $meta_key, $meta_type = null ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+function is_protected_meta( $meta_key, $meta_type = '' ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $protected = ( '_' == $meta_key[0] );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1044,24 +1052,25 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 3.2.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param bool $protected Whether the key is considered protected.
- * @param string $meta_key Meta key.
- * @param string|null $meta_type Type of object metadata is for (e.g., comment, post, term, or user).
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param bool $protected Whether the key is considered protected.
+ * @param string $meta_key Metadata key.
+ * @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.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> return apply_filters( 'is_protected_meta', $protected, $meta_key, $meta_type );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Sanitize meta value.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Sanitizes meta value.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 3.1.3
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 4.9.8 The `$object_subtype` parameter was added.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $meta_key Meta key.
- * @param mixed $meta_value Meta value to sanitize.
- * @param string $object_type Type of object the meta is registered to.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $meta_key Metadata key.
+ * @param mixed $meta_value Metadata value to sanitize.
+ * @param string $object_type Type of object metadata is for. Accepts 'post', 'comment', 'term', 'user',
+ * or any other object type with an associated meta table.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @param string $object_subtype Optional. The subtype of the object type.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- *
</del><span class="cx" style="display: block; padding: 0 10px"> * @return mixed Sanitized $meta_value.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function sanitize_meta( $meta_key, $meta_value, $object_type, $object_subtype = '' ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1076,9 +1085,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 4.9.8
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param mixed $meta_value Meta value to sanitize.
- * @param string $meta_key Meta key.
- * @param string $object_type Object type.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param mixed $meta_value Metadata value to sanitize.
+ * @param string $meta_key Metadata key.
+ * @param string $object_type Type of object metadata is for. Accepts 'post', 'comment', 'term', 'user',
+ * or any other object type with an associated meta table.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @param string $object_subtype Object subtype.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> return apply_filters( "sanitize_{$object_type}_meta_{$meta_key}_for_{$object_subtype}", $meta_value, $meta_key, $object_type, $object_subtype );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1093,9 +1103,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 3.3.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param mixed $meta_value Meta value to sanitize.
- * @param string $meta_key Meta key.
- * @param string $object_type Object type.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param mixed $meta_value Metadata value to sanitize.
+ * @param string $meta_key Metadata key.
+ * @param string $object_type Type of object metadata is for. Accepts 'post', 'comment', 'term', 'user',
+ * or any other object type with an associated meta table.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> return apply_filters( "sanitize_{$object_type}_meta_{$meta_key}", $meta_value, $meta_key, $object_type );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1117,8 +1128,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 4.9.8 The `$object_subtype` argument was added to the arguments array.
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 5.3.0 Valid meta types expanded to include "array" and "object".
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $object_type Type of object this meta is registered to.
- * @param string $meta_key Meta key to register.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $object_type Type of object metadata is for. Accepts 'post', 'comment', 'term', 'user',
+ * or any other object type with an associated meta table.
+ * @param string $meta_key Meta key to register.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @param array $args {
</span><span class="cx" style="display: block; padding: 0 10px"> * Data used to describe the meta key when registered.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1138,10 +1150,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * array with 'schema' or 'prepare_callback' keys instead of a boolean.
</span><span class="cx" style="display: block; padding: 0 10px"> * }
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string|array $deprecated Deprecated. Use `$args` instead.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- *
</del><span class="cx" style="display: block; padding: 0 10px"> * @return bool True if the meta key was successfully registered in the global array, false if not.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Registering a meta key with distinct sanitize and auth callbacks will fire those
- * callbacks, but will not add to the global registry.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Registering a meta key with distinct sanitize and auth callbacks will fire those callbacks,
+ * but will not add to the global registry.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function register_meta( $object_type, $meta_key, $args, $deprecated = null ) {
</span><span class="cx" style="display: block; padding: 0 10px"> global $wp_meta_keys;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1186,7 +1197,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @param array $args Array of meta registration arguments.
</span><span class="cx" style="display: block; padding: 0 10px"> * @param array $defaults Array of default arguments.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $object_type Object type.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $object_type Type of object metadata is for. Accepts 'post', 'comment', 'term', 'user',
+ * or any other object type with an associated meta table.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @param string $meta_key Meta key.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> $args = apply_filters( 'register_meta_args', $args, $defaults, $object_type, $meta_key );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1247,10 +1259,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 4.6.0
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 4.9.8 The `$object_subtype` parameter was added.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $object_type The type of object.
- * @param string $meta_key The meta key.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $object_type Type of object metadata is for. Accepts 'post', 'comment', 'term', 'user',
+ * or any other object type with an associated meta table.
+ * @param string $meta_key Metadata key.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @param string $object_subtype Optional. The subtype of the object type.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- *
</del><span class="cx" style="display: block; padding: 0 10px"> * @return bool True if the meta key is registered to the object type and, if provided,
</span><span class="cx" style="display: block; padding: 0 10px"> * the object subtype. False if not.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1266,8 +1278,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 4.6.0
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 4.9.8 The `$object_subtype` parameter was added.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $object_type The type of object.
- * @param string $meta_key The meta key.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $object_type Type of object metadata is for. Accepts 'post', 'comment', 'term', 'user',
+ * or any other object type with an associated meta table.
+ * @param string $meta_key Metadata key.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @param string $object_subtype Optional. The subtype of the object type.
</span><span class="cx" style="display: block; padding: 0 10px"> * @return bool True if successful. False if the meta key was not registered.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1315,7 +1328,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 4.6.0
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 4.9.8 The `$object_subtype` parameter was added.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $object_type The type of object. Post, comment, user, term.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $object_type Type of object metadata is for. Accepts 'post', 'comment', 'term', 'user',
+ * or any other object type with an associated meta table.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @param string $object_subtype Optional. The subtype of the object type.
</span><span class="cx" style="display: block; padding: 0 10px"> * @return string[] List of registered meta keys.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1337,7 +1351,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 4.6.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $object_type Type of object to request metadata for. (e.g. comment, post, term, user)
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $object_type Type of object metadata is for. Accepts 'post', 'comment', 'term', 'user',
+ * or any other object type with an associated meta table.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @param int $object_id ID of the object the metadata is for.
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string $meta_key Optional. Registered metadata key. If not specified, retrieve all registered
</span><span class="cx" style="display: block; padding: 0 10px"> * metadata for the specified object.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1378,7 +1393,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Filter out `register_meta()` args based on a whitelist.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Filters out `register_meta()` args based on a whitelist.
+ *
</ins><span class="cx" style="display: block; padding: 0 10px"> * `register_meta()` args may change over time, so requiring the whitelist
</span><span class="cx" style="display: block; padding: 0 10px"> * to be explicitly turned off is a warranty seal of sorts.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1387,7 +1403,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @param array $args Arguments from `register_meta()`.
</span><span class="cx" style="display: block; padding: 0 10px"> * @param array $default_args Default arguments for `register_meta()`.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- *
</del><span class="cx" style="display: block; padding: 0 10px"> * @return array Filtered arguments.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function _wp_register_meta_args_whitelist( $args, $default_args ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1399,7 +1414,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 4.9.8
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $object_type Type of object to request metadata for. (e.g. comment, post, term, user)
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $object_type Type of object metadata is for. Accepts 'post', 'comment', 'term', 'user',
+ * or any other object type with an associated meta table.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @param int $object_id ID of the object to retrieve its subtype.
</span><span class="cx" style="display: block; padding: 0 10px"> * @return string The object subtype or an empty string if unspecified subtype.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span></span></pre>
</div>
</div>
</body>
</html>