<!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>[29093] trunk/src/wp-includes/post.php: General inline documentation improvements in wp-includes/post.php.</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 { 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">
<dt>Revision</dt> <dd><a href="http://core.trac.wordpress.org/changeset/29093">29093</a></dd>
<dt>Author</dt> <dd>DrewAPicture</dd>
<dt>Date</dt> <dd>2014-07-11 10:27:02 +0000 (Fri, 11 Jul 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>General inline documentation improvements in wp-includes/post.php.
Third-run. See <a href="http://core.trac.wordpress.org/ticket/25412">#25412</a>.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpincludespostphp">trunk/src/wp-includes/post.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpincludespostphp"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-includes/post.php (29092 => 29093)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-includes/post.php 2014-07-11 08:15:52 UTC (rev 29092)
+++ trunk/src/wp-includes/post.php 2014-07-11 10:27:02 UTC (rev 29093)
</span><span class="lines">@@ -307,7 +307,7 @@
</span><span class="cx"> * @internal Claims made in the long description might be inaccurate.
</span><span class="cx"> * @since 2.0.0
</span><span class="cx"> *
</span><del>- * @see get_posts() Has additional arguments that can be replaced.
</del><ins>+ * @see get_posts()
</ins><span class="cx"> *
</span><span class="cx"> * @param mixed $args Optional. User defined arguments for replacing the defaults. Default empty.
</span><span class="cx"> * @param string $output Optional. Constant for return type. Accepts OBJECT, ARRAY_A, ARRAY_N.
</span><span class="lines">@@ -407,8 +407,6 @@
</span><span class="cx"> *
</span><span class="cx"> * @since 1.5.1
</span><span class="cx"> *
</span><del>- * @see http://codex.wordpress.org/Function_Reference/get_post
- *
</del><span class="cx"> * @param int|WP_Post $post Optional. Post ID or post object. Defaults to global $post.
</span><span class="cx"> * @param string $output Optional, default is Object. Accepts OBJECT, ARRAY_A, or ARRAY_N.
</span><span class="cx"> * Default OBJECT.
</span><span class="lines">@@ -1829,8 +1827,7 @@
</span><span class="cx"> *
</span><span class="cx"> * @todo Tie to WP_Query default args hash notation.
</span><span class="cx"> *
</span><del>- * @see WP_Query::query() See for more default arguments and information.
- * @see http://codex.wordpress.org/Template_Tags/get_posts
</del><ins>+ * @see WP_Query::query()
</ins><span class="cx"> *
</span><span class="cx"> * @param array $args Optional. Overrides defaults.
</span><span class="cx"> * @return array List of posts.
</span><span class="lines">@@ -1877,16 +1874,16 @@
</span><span class="cx"> * Post meta data is called "Custom Fields" on the Administration Screen.
</span><span class="cx"> *
</span><span class="cx"> * @since 1.5.0
</span><del>- * @link http://codex.wordpress.org/Function_Reference/add_post_meta
</del><span class="cx"> *
</span><del>- * @param int $post_id Post ID.
- * @param string $meta_key Metadata name.
- * @param mixed $meta_value Metadata value. Must be serializable if non-scalar.
- * @param bool $unique Optional, default is false. Whether the same key should not be added.
</del><ins>+ * @param int $post_id Post ID.
+ * @param string $meta_key Metadata name.
+ * @param mixed $meta_value Metadata value. Must be serializable if non-scalar.
+ * @param bool $unique Optional. Whether the same key should not be added.
+ * Default false.
</ins><span class="cx"> * @return int|bool Meta ID on success, false on failure.
</span><span class="cx"> */
</span><del>-function add_post_meta($post_id, $meta_key, $meta_value, $unique = false) {
- // make sure meta is added to the post, not a revision
</del><ins>+function add_post_meta( $post_id, $meta_key, $meta_value, $unique = false ) {
+ // Make sure meta is added to the post, not a revision.
</ins><span class="cx"> if ( $the_post = wp_is_post_revision($post_id) )
</span><span class="cx"> $post_id = $the_post;
</span><span class="cx">
</span><span class="lines">@@ -1901,15 +1898,15 @@
</span><span class="cx"> * allows removing all metadata matching key, if needed.
</span><span class="cx"> *
</span><span class="cx"> * @since 1.5.0
</span><del>- * @link http://codex.wordpress.org/Function_Reference/delete_post_meta
</del><span class="cx"> *
</span><del>- * @param int $post_id post ID
- * @param string $meta_key Metadata name.
- * @param mixed $meta_value Optional. Metadata value. Must be serializable if non-scalar.
</del><ins>+ * @param int $post_id Post ID.
+ * @param string $meta_key Metadata name.
+ * @param mixed $meta_value Optional. Metadata value. Must be serializable if
+ * non-scalar. Default empty.
</ins><span class="cx"> * @return bool True on success, false on failure.
</span><span class="cx"> */
</span><del>-function delete_post_meta($post_id, $meta_key, $meta_value = '') {
- // make sure meta is added to the post, not a revision
</del><ins>+function delete_post_meta( $post_id, $meta_key, $meta_value = '' ) {
+ // Make sure meta is added to the post, not a revision.
</ins><span class="cx"> if ( $the_post = wp_is_post_revision($post_id) )
</span><span class="cx"> $post_id = $the_post;
</span><span class="cx">
</span><span class="lines">@@ -1920,16 +1917,15 @@
</span><span class="cx"> * Retrieve post meta field for a post.
</span><span class="cx"> *
</span><span class="cx"> * @since 1.5.0
</span><del>- * @link http://codex.wordpress.org/Function_Reference/get_post_meta
</del><span class="cx"> *
</span><span class="cx"> * @param int $post_id Post ID.
</span><span class="cx"> * @param string $key Optional. The meta key to retrieve. By default, returns
</span><del>- * data for all keys.
</del><ins>+ * data for all keys. Default empty.
</ins><span class="cx"> * @param bool $single Optional. Whether to return a single value. Default false.
</span><span class="cx"> * @return mixed Will be an array if $single is false. Will be value of meta data
</span><span class="cx"> * field if $single is true.
</span><span class="cx"> */
</span><del>-function get_post_meta($post_id, $key = '', $single = false) {
</del><ins>+function get_post_meta( $post_id, $key = '', $single = false ) {
</ins><span class="cx"> return get_metadata('post', $post_id, $key, $single);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -1942,15 +1938,16 @@
</span><span class="cx"> * If the meta field for the post does not exist, it will be added.
</span><span class="cx"> *
</span><span class="cx"> * @since 1.5.0
</span><del>- * @link http://codex.wordpress.org/Function_Reference/update_post_meta
</del><span class="cx"> *
</span><del>- * @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 removing.
- * @return int|bool Meta ID if the key didn't exist, true on successful update, false on failure.
</del><ins>+ * @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 removing.
+ * Default empty.
+ * @return int|bool Meta ID if the key didn't exist, true on successful update,
+ * false on failure.
</ins><span class="cx"> */
</span><del>-function update_post_meta($post_id, $meta_key, $meta_value, $prev_value = '') {
</del><ins>+function update_post_meta( $post_id, $meta_key, $meta_value, $prev_value = '' ) {
</ins><span class="cx"> // make sure meta is added to the post, not a revision
</span><span class="cx"> if ( $the_post = wp_is_post_revision($post_id) )
</span><span class="cx"> $post_id = $the_post;
</span><span class="lines">@@ -1964,9 +1961,9 @@
</span><span class="cx"> * @since 2.3.0
</span><span class="cx"> *
</span><span class="cx"> * @param string $post_meta_key Key to search for when deleting.
</span><del>- * @return bool Whether the post meta key was deleted from the database
</del><ins>+ * @return bool Whether the post meta key was deleted from the database.
</ins><span class="cx"> */
</span><del>-function delete_post_meta_by_key($post_meta_key) {
</del><ins>+function delete_post_meta_by_key( $post_meta_key ) {
</ins><span class="cx"> return delete_metadata( 'post', null, $post_meta_key, '', true );
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -1977,7 +1974,6 @@
</span><span class="cx"> * so the function is optimized to be called more than once.
</span><span class="cx"> *
</span><span class="cx"> * @since 1.2.0
</span><del>- * @link http://codex.wordpress.org/Function_Reference/get_post_custom
</del><span class="cx"> *
</span><span class="cx"> * @param int $post_id Optional. Post ID. Default is ID of the global $post.
</span><span class="cx"> * @return array Post meta for the given post.
</span><span class="lines">@@ -1996,10 +1992,10 @@
</span><span class="cx"> * If there are no meta fields, then nothing (null) will be returned.
</span><span class="cx"> *
</span><span class="cx"> * @since 1.2.0
</span><del>- * @link http://codex.wordpress.org/Function_Reference/get_post_custom_keys
</del><span class="cx"> *
</span><span class="cx"> * @param int $post_id Optional. Post ID. Default is ID of the global $post.
</span><del>- * @return array|null Either array of the keys, or null if keys could not be retrieved.
</del><ins>+ * @return array|null Either array of the keys, or null if keys could not be
+ * retrieved.
</ins><span class="cx"> */
</span><span class="cx"> function get_post_custom_keys( $post_id = 0 ) {
</span><span class="cx"> $custom = get_post_custom( $post_id );
</span><span class="lines">@@ -2018,10 +2014,9 @@
</span><span class="cx"> * will be retrieved and only the meta field key values returned.
</span><span class="cx"> *
</span><span class="cx"> * @since 1.2.0
</span><del>- * @link http://codex.wordpress.org/Function_Reference/get_post_custom_values
</del><span class="cx"> *
</span><del>- * @param string $key Meta field key.
- * @param int $post_id Optional. Post ID. Default is ID of the global $post.
</del><ins>+ * @param string $key Optional. Meta field key. Default empty.
+ * @param int $post_id Optional. Post ID. Default is ID of the global $post.
</ins><span class="cx"> * @return array Meta field values.
</span><span class="cx"> */
</span><span class="cx"> function get_post_custom_values( $key = '', $post_id = 0 ) {
</span><span class="lines">@@ -2064,18 +2059,23 @@
</span><span class="cx"> /**
</span><span class="cx"> * Sanitize every post field.
</span><span class="cx"> *
</span><del>- * If the context is 'raw', then the post object or array will get minimal santization of the int fields.
</del><ins>+ * If the context is 'raw', then the post object or array will get minimal
+ * sanitization of the integer fields.
</ins><span class="cx"> *
</span><span class="cx"> * @since 2.3.0
</span><del>- * @uses sanitize_post_field() Used to sanitize the fields.
</del><span class="cx"> *
</span><del>- * @param object|WP_Post|array $post The Post Object or Array
- * @param string $context Optional, default is 'display'. How to sanitize post fields.
- * @return object|WP_Post|array The now sanitized Post Object or Array (will be the same type as $post)
</del><ins>+ * @see sanitize_post_field()
+ *
+ * @param object|WP_Post|array $post The Post Object or Array
+ * @param string $context Optional. How to sanitize post fields.
+ * Accepts 'raw', 'edit', 'db', or 'display'.
+ * Default 'display'.
+ * @return object|WP_Post|array The now sanitized Post Object or Array (will be the
+ * same type as $post).
</ins><span class="cx"> */
</span><del>-function sanitize_post($post, $context = 'display') {
</del><ins>+function sanitize_post( $post, $context = 'display' ) {
</ins><span class="cx"> if ( is_object($post) ) {
</span><del>- // Check if post already filtered for this context
</del><ins>+ // Check if post already filtered for this context.
</ins><span class="cx"> if ( isset($post->filter) && $context == $post->filter )
</span><span class="cx"> return $post;
</span><span class="cx"> if ( !isset($post->ID) )
</span><span class="lines">@@ -2084,7 +2084,7 @@
</span><span class="cx"> $post->$field = sanitize_post_field($field, $post->$field, $post->ID, $context);
</span><span class="cx"> $post->filter = $context;
</span><span class="cx"> } else {
</span><del>- // Check if post already filtered for this context
</del><ins>+ // Check if post already filtered for this context.
</ins><span class="cx"> if ( isset($post['filter']) && $context == $post['filter'] )
</span><span class="cx"> return $post;
</span><span class="cx"> if ( !isset($post['ID']) )
</span><span class="lines">@@ -2099,17 +2099,17 @@
</span><span class="cx"> /**
</span><span class="cx"> * Sanitize post field based on context.
</span><span class="cx"> *
</span><del>- * Possible context values are: 'raw', 'edit', 'db', 'display', 'attribute' and 'js'. The
- * 'display' context is used by default. 'attribute' and 'js' contexts are treated like 'display'
- * when calling filters.
</del><ins>+ * Possible context values are: 'raw', 'edit', 'db', 'display', 'attribute' and
+ * 'js'. The 'display' context is used by default. 'attribute' and 'js' contexts
+ * are treated like 'display' when calling filters.
</ins><span class="cx"> *
</span><span class="cx"> * @since 2.3.0
</span><span class="cx"> *
</span><del>- * @param string $field The Post Object field name.
- * @param mixed $value The Post Object value.
- * @param int $post_id Post ID.
- * @param string $context How to sanitize post fields. Looks for 'raw', 'edit', 'db', 'display',
- * 'attribute' and 'js'.
</del><ins>+ * @param string $field The Post Object field name.
+ * @param mixed $value The Post Object value.
+ * @param int $post_id Post ID.
+ * @param string $context How to sanitize post fields. Looks for 'raw', 'edit',
+ * 'db', 'display', 'attribute' and 'js'.
</ins><span class="cx"> * @return mixed Sanitized value.
</span><span class="cx"> */
</span><span class="cx"> function sanitize_post_field($field, $value, $post_id, $context) {
</span><span class="lines">@@ -2117,7 +2117,7 @@
</span><span class="cx"> if ( in_array($field, $int_fields) )
</span><span class="cx"> $value = (int) $value;
</span><span class="cx">
</span><del>- // Fields which contain arrays of ints.
</del><ins>+ // Fields which contain arrays of integers.
</ins><span class="cx"> $array_int_fields = array( 'ancestors' );
</span><span class="cx"> if ( in_array($field, $array_int_fields) ) {
</span><span class="cx"> $value = array_map( 'absint', $value);
</span><span class="lines">@@ -2141,7 +2141,8 @@
</span><span class="cx"> /**
</span><span class="cx"> * Filter the value of a specific post field to edit.
</span><span class="cx"> *
</span><del>- * The dynamic portion of the hook name, $field, refers to the post field name.
</del><ins>+ * The dynamic portion of the hook name, $field, refers to the post
+ * field name.
</ins><span class="cx"> *
</span><span class="cx"> * @since 2.3.0
</span><span class="cx"> *
</span><span class="lines">@@ -2180,7 +2181,8 @@
</span><span class="cx"> /**
</span><span class="cx"> * Filter the value of a specific post field before saving.
</span><span class="cx"> *
</span><del>- * The dynamic portion of the hook name, $field, refers to the post field name.
</del><ins>+ * The dynamic portion of the hook name, $field, refers to the post
+ * field name.
</ins><span class="cx"> *
</span><span class="cx"> * @since 2.3.0
</span><span class="cx"> *
</span><span class="lines">@@ -2205,7 +2207,8 @@
</span><span class="cx"> /**
</span><span class="cx"> * Filter the value of a specific post field before saving.
</span><span class="cx"> *
</span><del>- * The dynamic portion of the hook name, $field, refers to the post field name.
</del><ins>+ * The dynamic portion of the hook name, $field, refers to the post
+ * field name.
</ins><span class="cx"> *
</span><span class="cx"> * @since 2.3.0
</span><span class="cx"> *
</span><span class="lines">@@ -2221,7 +2224,8 @@
</span><span class="cx"> /**
</span><span class="cx"> * Filter the value of a specific post field for display.
</span><span class="cx"> *
</span><del>- * The dynamic portion of the hook name, $field, refers to the post field name.
</del><ins>+ * The dynamic portion of the hook name, $field, refers to the post
+ * field name.
</ins><span class="cx"> *
</span><span class="cx"> * @since 2.3.0
</span><span class="cx"> *
</span><span class="lines">@@ -2254,7 +2258,7 @@
</span><span class="cx"> *
</span><span class="cx"> * @param int $post_id Post ID.
</span><span class="cx"> */
</span><del>-function stick_post($post_id) {
</del><ins>+function stick_post( $post_id ) {
</ins><span class="cx"> $stickies = get_option('sticky_posts');
</span><span class="cx">
</span><span class="cx"> if ( !is_array($stickies) )
</span><span class="lines">@@ -2267,7 +2271,7 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><del>- * Unstick a post.
</del><ins>+ * Un-stick a post.
</ins><span class="cx"> *
</span><span class="cx"> * Sticky posts should be displayed at the top of the front page.
</span><span class="cx"> *
</span><span class="lines">@@ -2275,7 +2279,7 @@
</span><span class="cx"> *
</span><span class="cx"> * @param int $post_id Post ID.
</span><span class="cx"> */
</span><del>-function unstick_post($post_id) {
</del><ins>+function unstick_post( $post_id ) {
</ins><span class="cx"> $stickies = get_option('sticky_posts');
</span><span class="cx">
</span><span class="cx"> if ( !is_array($stickies) )
</span><span class="lines">@@ -2294,12 +2298,12 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><del>- * Return the cache key for wp_count_posts() based on the passed arguments
</del><ins>+ * Return the cache key for wp_count_posts() based on the passed arguments.
</ins><span class="cx"> *
</span><span class="cx"> * @since 3.9.0
</span><span class="cx"> *
</span><del>- * @param string $type Optional. Post type to retrieve count
- * @param string $perm Optional. 'readable' or empty.
</del><ins>+ * @param string $type Optional. Post type to retrieve count Default 'post'.
+ * @param string $perm Optional. 'readable' or empty. Default empty.
</ins><span class="cx"> * @return string The cache key.
</span><span class="cx"> */
</span><span class="cx"> function _count_posts_cache_key( $type = 'post', $perm = '' ) {
</span><span class="lines">@@ -2324,13 +2328,11 @@
</span><span class="cx"> * The $perm parameter checks for 'readable' value and if the user can read
</span><span class="cx"> * private posts, it will display that for the user that is signed in.
</span><span class="cx"> *
</span><del>- * @link http://codex.wordpress.org/Template_Tags/wp_count_posts
- *
</del><span class="cx"> * @since 2.5.0
</span><span class="cx"> *
</span><del>- * @param string $type Optional. Post type to retrieve count
- * @param string $perm Optional. 'readable' or empty.
- * @return object Number of posts for each status
</del><ins>+ * @param string $type Optional. Post type to retrieve count. Default 'post'.
+ * @param string $perm Optional. 'readable' or empty. Default empty.
+ * @return object Number of posts for each status.
</ins><span class="cx"> */
</span><span class="cx"> function wp_count_posts( $type = 'post', $perm = '' ) {
</span><span class="cx"> global $wpdb;
</span><span class="lines">@@ -2387,7 +2389,8 @@
</span><span class="cx"> *
</span><span class="cx"> * @since 2.5.0
</span><span class="cx"> *
</span><del>- * @param string|array $mime_type Optional. Array or comma-separated list of MIME patterns.
</del><ins>+ * @param string|array $mime_type Optional. Array or comma-separated list of
+ * MIME patterns. Default empty.
</ins><span class="cx"> * @return object An object containing the attachment counts by mime type.
</span><span class="cx"> */
</span><span class="cx"> function wp_count_attachments( $mime_type = '' ) {
</span><span class="lines">@@ -2407,18 +2410,20 @@
</span><span class="cx"> *
</span><span class="cx"> * @since 3.7.0
</span><span class="cx"> *
</span><del>- * @param object $counts An object containing the attachment counts by mime type.
- * @param string $mime_type The mime type pattern used to filter the attachments counted.
</del><ins>+ * @param object $counts An object containing the attachment counts by
+ * mime type.
+ * @param string $mime_type The mime type pattern used to filter the attachments
+ * counted.
</ins><span class="cx"> */
</span><span class="cx"> return apply_filters( 'wp_count_attachments', (object) $counts, $mime_type );
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><del>- * Get default post mime types
</del><ins>+ * Get default post mime types.
</ins><span class="cx"> *
</span><span class="cx"> * @since 2.9.0
</span><span class="cx"> *
</span><del>- * @return array
</del><ins>+ * @return array List of post mime types.
</ins><span class="cx"> */
</span><span class="cx"> function get_post_mime_types() {
</span><span class="cx"> $post_mime_types = array( // array( adj, noun )
</span><span class="lines">@@ -2446,10 +2451,10 @@
</span><span class="cx"> *
</span><span class="cx"> * @since 2.5.0
</span><span class="cx"> *
</span><del>- * @param string|array $wildcard_mime_types e.g. audio/mpeg or image (same as image/*) or
- * flash (same as *flash*).
- * @param string|array $real_mime_types post_mime_type values
- * @return array array(wildcard=>array(real types))
</del><ins>+ * @param string|array $wildcard_mime_types Mime types, e.g. audio/mpeg or image (same as image/*)
+ * or flash (same as *flash*).
+ * @param string|array $real_mime_types Real post mime type values.
+ * @return array array(wildcard=>array(real types)).
</ins><span class="cx"> */
</span><span class="cx"> function wp_match_mime_types( $wildcard_mime_types, $real_mime_types ) {
</span><span class="cx"> $matches = array();
</span><span class="lines">@@ -2490,11 +2495,13 @@
</span><span class="cx"> *
</span><span class="cx"> * @since 2.5.0
</span><span class="cx"> *
</span><del>- * @param string|array $post_mime_types List of mime types or comma separated string of mime types.
- * @param string $table_alias Optional. Specify a table alias, if needed.
</del><ins>+ * @param string|array $post_mime_types List of mime types or comma separated string
+ * of mime types.
+ * @param string $table_alias Optional. Specify a table alias, if needed.
+ * Default empty.
</ins><span class="cx"> * @return string The SQL AND clause for mime searching.
</span><span class="cx"> */
</span><del>-function wp_post_mime_type_where($post_mime_types, $table_alias = '') {
</del><ins>+function wp_post_mime_type_where( $post_mime_types, $table_alias = '' ) {
</ins><span class="cx"> $where = '';
</span><span class="cx"> $wildcards = array('', '%', '%/%');
</span><span class="cx"> if ( is_string($post_mime_types) )
</span><span class="lines">@@ -2532,22 +2539,25 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><del>- * Trashes or deletes a post or page.
</del><ins>+ * Trash or delete a post or page.
</ins><span class="cx"> *
</span><del>- * When the post and page is permanently deleted, everything that is tied to it is deleted also.
- * This includes comments, post meta fields, and terms associated with the post.
</del><ins>+ * When the post and page is permanently deleted, everything that is tied to
+ * it is deleted also. This includes comments, post meta fields, and terms
+ * associated with the post.
</ins><span class="cx"> *
</span><del>- * The post or page is moved to trash instead of permanently deleted unless trash is
- * disabled, item is already in the trash, or $force_delete is true.
</del><ins>+ * The post or page is moved to trash instead of permanently deleted unless
+ * trash is disabled, item is already in the trash, or $force_delete is true.
</ins><span class="cx"> *
</span><span class="cx"> * @since 1.0.0
</span><span class="cx"> *
</span><del>- * @uses wp_delete_attachment() if post type is 'attachment'.
- * @uses wp_trash_post() if item should be trashed.
</del><ins>+ * @global wpdb $wpdb WordPress database access abstraction object.
+ * @see wp_delete_attachment()
+ * @see wp_trash_post()
</ins><span class="cx"> *
</span><del>- * @param int $postid Post ID.
- * @param bool $force_delete Whether to bypass trash and force deletion. Defaults to false.
- * @return mixed False on failure
</del><ins>+ * @param int $postid Optional. Post ID. Default 0.
+ * @param bool $force_delete Optional. Whether to bypass trash and force deletion.
+ * Default false.
+ * @return array|bool|WP_Post False on failure.
</ins><span class="cx"> */
</span><span class="cx"> function wp_delete_post( $postid = 0, $force_delete = false ) {
</span><span class="cx"> global $wpdb;
</span><span class="lines">@@ -2651,14 +2661,15 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><del>- * Resets the page_on_front, show_on_front, and page_for_post settings when a
- * linked page is deleted or trashed.
</del><ins>+ * Reset the page_on_front, show_on_front, and page_for_post settings when
+ * a linked page is deleted or trashed.
</ins><span class="cx"> *
</span><span class="cx"> * Also ensures the post is no longer sticky.
</span><span class="cx"> *
</span><ins>+ * @since 3.7.0
</ins><span class="cx"> * @access private
</span><del>- * @since 3.7.0
- * @param $post_id
</del><ins>+ *
+ * @param int $post_id Post ID.
</ins><span class="cx"> */
</span><span class="cx"> function _reset_front_page_settings_for_post( $post_id ) {
</span><span class="cx"> $post = get_post( $post_id );
</span><span class="lines">@@ -2679,19 +2690,19 @@
</span><span class="cx"> add_action( 'wp_trash_post', '_reset_front_page_settings_for_post' );
</span><span class="cx">
</span><span class="cx"> /**
</span><del>- * Moves a post or page to the Trash
</del><ins>+ * Move a post or page to the Trash
</ins><span class="cx"> *
</span><span class="cx"> * If trash is disabled, the post or page is permanently deleted.
</span><span class="cx"> *
</span><span class="cx"> * @since 2.9.0
</span><span class="cx"> *
</span><del>- * @uses wp_delete_post() if trash is disabled
</del><ins>+ * @see wp_delete_post()
</ins><span class="cx"> *
</span><del>- * @param int $post_id Optional. Post ID. Default is ID of the global `$post`
</del><ins>+ * @param int $post_id Optional. Post ID. Default is ID of the global $post
</ins><span class="cx"> * if EMPTY_TRASH_DAYS equals true.
</span><span class="cx"> * @return bool|array Post data array, otherwise false.
</span><span class="cx"> */
</span><del>-function wp_trash_post($post_id = 0) {
</del><ins>+function wp_trash_post( $post_id = 0 ) {
</ins><span class="cx"> if ( !EMPTY_TRASH_DAYS )
</span><span class="cx"> return wp_delete_post($post_id, true);
</span><span class="cx">
</span><span class="lines">@@ -2731,12 +2742,12 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><del>- * Restores a post or page from the Trash
</del><ins>+ * Restore a post or page from the Trash.
</ins><span class="cx"> *
</span><span class="cx"> * @since 2.9.0
</span><span class="cx"> *
</span><span class="cx"> * @param int $post_id Optional. Post ID. Default is ID of the global $post.
</span><del>- * @return mixed False on failure
</del><ins>+ * @return WP_Post|bool WP_Post object. False on failure.
</ins><span class="cx"> */
</span><span class="cx"> function wp_untrash_post( $post_id = 0 ) {
</span><span class="cx"> if ( !$post = get_post($post_id, ARRAY_A) )
</span><span class="lines">@@ -2778,14 +2789,16 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><del>- * Moves comments for a post to the trash
</del><ins>+ * Moves comments for a post to the trash.
</ins><span class="cx"> *
</span><span class="cx"> * @since 2.9.0
</span><span class="cx"> *
</span><del>- * @param int|WP_Post $post Optional. Post ID or post object.
- * @return mixed False on failure
</del><ins>+ * @global wpdb $wpdb WordPress database access abstraction object.
+ *
+ * @param int|WP_Post $post Optional. Post ID or post object. Defaults to global $post.
+ * @return mixed False on failure.
</ins><span class="cx"> */
</span><del>-function wp_trash_post_comments($post = null) {
</del><ins>+function wp_trash_post_comments( $post = null ) {
</ins><span class="cx"> global $wpdb;
</span><span class="cx">
</span><span class="cx"> $post = get_post($post);
</span><span class="lines">@@ -2832,14 +2845,14 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><del>- * Restore comments for a post from the trash
</del><ins>+ * Restore comments for a post from the trash.
</ins><span class="cx"> *
</span><span class="cx"> * @since 2.9.0
</span><span class="cx"> *
</span><del>- * @param int|WP_Post $post Optional. Post ID or post object.
- * @return mixed False on failure
</del><ins>+ * @param int|WP_Post $post Optional. Post ID or post object. Defaults to global $post.
+ * @return mixed False on failure.
</ins><span class="cx"> */
</span><del>-function wp_untrash_post_comments($post = null) {
</del><ins>+function wp_untrash_post_comments( $post = null ) {
</ins><span class="cx"> global $wpdb;
</span><span class="cx">
</span><span class="cx"> $post = get_post($post);
</span><span class="lines">@@ -2897,11 +2910,12 @@
</span><span class="cx"> *
</span><span class="cx"> * @since 2.1.0
</span><span class="cx"> *
</span><del>- * @uses wp_get_object_terms() Retrieves the categories. Args details can be found here.
</del><ins>+ * @see wp_get_object_terms()
</ins><span class="cx"> *
</span><del>- * @param int $post_id Optional. The Post ID. Does not default to the ID of the global $post.
- * @param array $args Optional. Overwrite the defaults.
- * @return array
</del><ins>+ * @param int $post_id Optional. The Post ID. Does not default to the ID of the
+ * global $post. Default 0.
+ * @param array $args Optional. Category arguments. Default empty.
+ * @return array List of categories.
</ins><span class="cx"> */
</span><span class="cx"> function wp_get_post_categories( $post_id = 0, $args = array() ) {
</span><span class="cx"> $post_id = (int) $post_id;
</span><span class="lines">@@ -2922,9 +2936,10 @@
</span><span class="cx"> *
</span><span class="cx"> * @since 2.3.0
</span><span class="cx"> *
</span><del>- * @uses wp_get_object_terms() Gets the tags for returning. Args can be found here
</del><ins>+ * @uses wp_get_object_terms()
</ins><span class="cx"> *
</span><del>- * @param int $post_id Optional. The Post ID. Does not default to the ID of the global $post.
</del><ins>+ * @param int $post_id Optional. The Post ID. Does not default to the ID of the
+ * global $post. Defualt 0.
</ins><span class="cx"> * @param array $args Optional. Overwrite the defaults
</span><span class="cx"> * @return array List of post tags.
</span><span class="cx"> */
</span><span class="lines">@@ -2941,11 +2956,12 @@
</span><span class="cx"> *
</span><span class="cx"> * @since 2.8.0
</span><span class="cx"> *
</span><del>- * @uses wp_get_object_terms() Gets the tags for returning. Args can be found here
</del><ins>+ * @uses wp_get_object_terms()
</ins><span class="cx"> *
</span><del>- * @param int $post_id Optional. The Post ID. Does not default to the ID of the global $post.
- * @param string $taxonomy The taxonomy for which to retrieve terms. Defaults to post_tag.
- * @param array $args Optional. {@link wp_get_object_terms()} arguments.
</del><ins>+ * @param int $post_id Optional. The Post ID. Does not default to the ID of the
+ * global $post. Default 0.
+ * @param string $taxonomy Optional. The taxonomy for which to retrieve terms. Default 'post_tag'.
+ * @param array $args Optional. {@link wp_get_object_terms()} arguments. Default empty array.
</ins><span class="cx"> * @return array List of post tags.
</span><span class="cx"> */
</span><span class="cx"> function wp_get_post_terms( $post_id = 0, $taxonomy = 'post_tag', $args = array() ) {
</span><span class="lines">@@ -2960,16 +2976,16 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><del>- * Retrieve number of recent posts.
</del><ins>+ * Retrieve a number of recent posts.
</ins><span class="cx"> *
</span><span class="cx"> * @since 1.0.0
</span><del>- * @uses wp_parse_args()
- * @uses get_posts()
</del><span class="cx"> *
</span><del>- * @param string $deprecated Deprecated.
- * @param array $args Optional. Overrides defaults.
- * @param string $output Optional.
- * @return unknown.
</del><ins>+ * @see get_posts()
+ *
+ * @param string $deprecated Not used.
+ * @param array $args Optional. Arguments to retrieve posts. Default empty array.
+ * @param string $output Optional. Type of output. Accepts ARRAY_A or ''. Default ARRAY_A.
+ * @return array|bool Associative array if $output equals ARRAY_A, array or false if no results.
</ins><span class="cx"> */
</span><span class="cx"> function wp_get_recent_posts( $args = array(), $output = ARRAY_A ) {
</span><span class="cx">
</span><span class="lines">@@ -3013,30 +3029,34 @@
</span><span class="cx"> * and 'post_date_gmt' keys. You can close the comments or open the comments by
</span><span class="cx"> * setting the value for 'comment_status' key.
</span><span class="cx"> *
</span><del>- * @global wpdb $wpdb WordPress database abstraction object.
- *
</del><span class="cx"> * @since 1.0.0
</span><span class="cx"> *
</span><ins>+ * @see sanitize_post()
+ * @global wpdb $wpdb WordPress database abstraction object.
+ *
</ins><span class="cx"> * @param array $postarr {
</span><span class="cx"> * An array of elements that make up a post to update or insert.
</span><span class="cx"> *
</span><del>- * @type int $ID The post ID. If equal to something other than 0, the post with that ID will
- * be updated. Default 0.
</del><ins>+ * @type int $ID The post ID. If equal to something other than 0,
+ * the post with that ID will be updated. Default 0.
</ins><span class="cx"> * @type string $post_status The post status. Default 'draft'.
</span><span class="cx"> * @type string $post_type The post type. Default 'post'.
</span><del>- * @type int $post_author The ID of the user who added the post. Default the current user ID.
- * @type bool $ping_status Whether the post can accept pings. Default value of 'default_ping_status' option.
</del><ins>+ * @type int $post_author The ID of the user who added the post. Default is
+ * the current user ID.
+ * @type bool $ping_status Whether the post can accept pings. Default is the
+ * value of 'default_ping_status' option.
</ins><span class="cx"> * @type int $post_parent Set this for the post it belongs to, if any. Default 0.
</span><span class="cx"> * @type int $menu_order The order it is displayed. Default 0.
</span><del>- * @type string $to_ping Space or carriage return-separated list of URLs to ping. Default empty string.
- * @type string $pinged Space or carriage return-separated list of URLs that have been pinged.
</del><ins>+ * @type string $to_ping Space or carriage return-separated list of URLs to ping.
</ins><span class="cx"> * Default empty string.
</span><ins>+ * @type string $pinged Space or carriage return-separated list of URLs that have
+ * been pinged. Default empty string.
</ins><span class="cx"> * @type string $post_password The password to access the post. Default empty string.
</span><span class="cx"> * @type string $guid' Global Unique ID for referencing the post.
</span><span class="cx"> * @type string $post_content_filtered The filtered post content. Default empty string.
</span><span class="cx"> * @type string $post_excerpt The post excerpt. Default empty string.
</span><span class="cx"> * }
</span><del>- * @param bool $wp_error Optional. Allow return of WP_Error on failure.
</del><ins>+ * @param bool $wp_error Optional. Whether to allow return of WP_Error on failure. Default false.
</ins><span class="cx"> * @return int|WP_Error The post ID on success. The value 0 or WP_Error on failure.
</span><span class="cx"> */
</span><span class="cx"> function wp_insert_post( $postarr, $wp_error = false ) {
</span><span class="lines">@@ -3064,7 +3084,7 @@
</span><span class="cx"> if ( ! empty( $postarr['ID'] ) ) {
</span><span class="cx"> $update = true;
</span><span class="cx">
</span><del>- // Get the post ID and GUID
</del><ins>+ // Get the post ID and GUID.
</ins><span class="cx"> $post_ID = $postarr['ID'];
</span><span class="cx"> $post_before = get_post( $post_ID );
</span><span class="cx"> if ( is_null( $post_before ) ) {
</span><span class="lines">@@ -3125,7 +3145,8 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if ( ! empty( $postarr['post_category'] ) ) {
</span><del>- $post_category = array_filter( $postarr['post_category'] ); // Filter out empty terms
</del><ins>+ // Filter out empty terms.
+ $post_category = array_filter( $postarr['post_category'] );
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // Make sure we set a valid category.
</span><span class="lines">@@ -3138,13 +3159,15 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>- // Don't allow contributors to set the post slug for pending review posts
</del><ins>+ // Don't allow contributors to set the post slug for pending review posts.
</ins><span class="cx"> if ( 'pending' == $post_status && !current_user_can( 'publish_posts' ) ) {
</span><span class="cx"> $post_name = '';
</span><span class="cx"> }
</span><span class="cx">
</span><del>- // Create a valid post name. Drafts and pending posts are allowed to have an empty
- // post name.
</del><ins>+ /*
+ * Create a valid post name. Drafts and pending posts are allowed to have
+ * an empty post name.
+ */
</ins><span class="cx"> if ( empty($post_name) ) {
</span><span class="cx"> if ( !in_array( $post_status, array( 'draft', 'pending', 'auto-draft' ) ) ) {
</span><span class="cx"> $post_name = sanitize_title($post_title);
</span><span class="lines">@@ -3161,14 +3184,17 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>- // If the post date is empty (due to having been new or a draft) and status is not 'draft' or 'pending', set date to now
</del><ins>+ /*
+ * If the post date is empty (due to having been new or a draft) and status
+ * is not 'draft' or 'pending', set date to now.
+ */
</ins><span class="cx"> if ( empty( $postarr['post_date'] ) || '0000-00-00 00:00:00' == $postarr['post_date'] ) {
</span><span class="cx"> $post_date = current_time( 'mysql' );
</span><span class="cx"> } else {
</span><span class="cx"> $post_date = $postarr['post_date'];
</span><span class="cx"> }
</span><span class="cx">
</span><del>- // validate the date
</del><ins>+ // Validate the date.
</ins><span class="cx"> $mm = substr( $post_date, 5, 2 );
</span><span class="cx"> $jj = substr( $post_date, 8, 2 );
</span><span class="cx"> $aa = substr( $post_date, 0, 4 );
</span><span class="lines">@@ -3223,7 +3249,7 @@
</span><span class="cx"> $comment_status = $postarr['comment_status'];
</span><span class="cx"> }
</span><span class="cx">
</span><del>- // these variables are needed by compact() later
</del><ins>+ // These variables are needed by compact() later.
</ins><span class="cx"> $post_content_filtered = $postarr['post_content_filtered'];
</span><span class="cx"> $post_author = empty( $postarr['post_author'] ) ? $user_id : $postarr['post_author'];
</span><span class="cx"> $ping_status = empty( $postarr['ping_status'] ) ? get_option( 'default_ping_status' ) : $postarr['ping_status'];
</span><span class="lines">@@ -3231,8 +3257,10 @@
</span><span class="cx"> $pinged = isset( $postarr['pinged'] ) ? $postarr['pinged'] : '';
</span><span class="cx"> $import_id = isset( $postarr['import_id'] ) ? $postarr['import_id'] : 0;
</span><span class="cx">
</span><del>- // The 'wp_insert_post_parent' filter expects all variables to be present.
- // Previously, these variables would have already been extracted
</del><ins>+ /*
+ * The 'wp_insert_post_parent' filter expects all variables to be present.
+ * Previously, these variables would have already been extracted
+ */
</ins><span class="cx"> if ( isset( $postarr['menu_order'] ) ) {
</span><span class="cx"> $menu_order = (int) $postarr['menu_order'];
</span><span class="cx"> } else {
</span><span class="lines">@@ -3264,10 +3292,10 @@
</span><span class="cx">
</span><span class="cx"> $post_name = wp_unique_post_slug( $post_name, $post_ID, $post_status, $post_type, $post_parent );
</span><span class="cx">
</span><del>- // don't unslash
</del><ins>+ // Don't unslash.
</ins><span class="cx"> $post_mime_type = isset( $postarr['post_mime_type'] ) ? $postarr['post_mime_type'] : '';
</span><span class="cx">
</span><del>- // expected_slashed (everything!)
</del><ins>+ // Expected_slashed (everything!).
</ins><span class="cx"> $data = compact( 'post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_content_filtered', 'post_title', 'post_excerpt', 'post_status', 'post_type', 'comment_status', 'ping_status', 'post_password', 'post_name', 'to_ping', 'pinged', 'post_modified', 'post_modified_gmt', 'post_parent', 'menu_order', 'post_mime_type', 'guid' );
</span><span class="cx">
</span><span class="cx"> if ( 'attachment' === $post_type ) {
</span><span class="lines">@@ -3312,7 +3340,7 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> } else {
</span><del>- // If there is a suggested ID, use it if not already present
</del><ins>+ // If there is a suggested ID, use it if not already present.
</ins><span class="cx"> if ( ! empty( $import_id ) ) {
</span><span class="cx"> $import_id = (int) $import_id;
</span><span class="cx"> if ( ! $wpdb->get_var( $wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE ID = %d", $import_id) ) ) {
</span><span class="lines">@@ -3328,7 +3356,7 @@
</span><span class="cx"> }
</span><span class="cx"> $post_ID = (int) $wpdb->insert_id;
</span><span class="cx">
</span><del>- // use the newly generated $post_ID
</del><ins>+ // Use the newly generated $post_ID.
</ins><span class="cx"> $where = array( 'ID' => $post_ID );
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -3345,11 +3373,12 @@
</span><span class="cx"> wp_set_post_tags( $post_ID, $postarr['tags_input'] );
</span><span class="cx"> }
</span><span class="cx">
</span><del>- // new-style support for all custom taxonomies
</del><ins>+ // New-style support for all custom taxonomies.
</ins><span class="cx"> if ( ! empty( $postarr['tax_input'] ) ) {
</span><span class="cx"> foreach ( $postarr['tax_input'] as $taxonomy => $tags ) {
</span><span class="cx"> $taxonomy_obj = get_taxonomy($taxonomy);
</span><del>- if ( is_array( $tags ) ) { // array = hierarchical, string = non-hierarchical.
</del><ins>+ // array = hierarchical, string = non-hierarchical.
+ if ( is_array( $tags ) ) {
</ins><span class="cx"> $tags = array_filter($tags);
</span><span class="cx"> }
</span><span class="cx"> if ( current_user_can( $taxonomy_obj->cap->assign_terms ) ) {
</span><span class="lines">@@ -3360,7 +3389,7 @@
</span><span class="cx">
</span><span class="cx"> $current_guid = get_post_field( 'guid', $post_ID );
</span><span class="cx">
</span><del>- // Set GUID
</del><ins>+ // Set GUID.
</ins><span class="cx"> if ( ! $update && '' == $current_guid ) {
</span><span class="cx"> $wpdb->update( $wpdb->posts, array( 'guid' => get_permalink( $post_ID ) ), $where );
</span><span class="cx"> }
</span><span class="lines">@@ -3490,8 +3519,9 @@
</span><span class="cx"> *
</span><span class="cx"> * @since 1.0.0
</span><span class="cx"> *
</span><del>- * @param array|object $postarr Post data. Arrays are expected to be escaped, objects are not.
- * @param bool $wp_error Optional. Allow return of WP_Error on failure.
</del><ins>+ * @param array|object $postarr Optional. Post data. Arrays are expected to be escaped,
+ * objects are not. Default array.
+ * @param bool $wp_error Optional. Allow return of WP_Error on failure. Default false.
</ins><span class="cx"> * @return int|WP_Error The value 0 or WP_Error on failure. The post ID on success.
</span><span class="cx"> */
</span><span class="cx"> function wp_update_post( $postarr = array(), $wp_error = false ) {
</span><span class="lines">@@ -3501,7 +3531,7 @@
</span><span class="cx"> $postarr = wp_slash($postarr);
</span><span class="cx"> }
</span><span class="cx">
</span><del>- // First, get all of the original fields
</del><ins>+ // First, get all of the original fields.
</ins><span class="cx"> $post = get_post($postarr['ID'], ARRAY_A);
</span><span class="cx">
</span><span class="cx"> if ( is_null( $post ) ) {
</span><span class="lines">@@ -3520,7 +3550,7 @@
</span><span class="cx"> else
</span><span class="cx"> $post_cats = $post['post_category'];
</span><span class="cx">
</span><del>- // Drafts shouldn't be assigned a date unless explicitly done so by the user
</del><ins>+ // Drafts shouldn't be assigned a date unless explicitly done so by the user.
</ins><span class="cx"> if ( isset( $post['post_status'] ) && in_array($post['post_status'], array('draft', 'pending', 'auto-draft')) && empty($postarr['edit_date']) &&
</span><span class="cx"> ('0000-00-00 00:00:00' == $post['post_date_gmt']) )
</span><span class="cx"> $clear_date = true;
</span><span class="lines">@@ -3545,8 +3575,9 @@
</span><span class="cx"> * Publish a post by transitioning the post status.
</span><span class="cx"> *
</span><span class="cx"> * @since 2.1.0
</span><del>- * @uses $wpdb
</del><span class="cx"> *
</span><ins>+ * @global wpdb $wpdb WordPress database abstraction object.
+ *
</ins><span class="cx"> * @param int|WP_Post $post Post ID or post object.
</span><span class="cx"> */
</span><span class="cx"> function wp_publish_post( $post ) {
</span><span class="lines">@@ -3568,10 +3599,13 @@
</span><span class="cx">
</span><span class="cx"> /** This action is documented in wp-includes/post.php */
</span><span class="cx"> do_action( 'edit_post', $post->ID, $post );
</span><ins>+
</ins><span class="cx"> /** This action is documented in wp-includes/post.php */
</span><span class="cx"> do_action( "save_post_{$post->post_type}", $post->ID, $post, true );
</span><ins>+
</ins><span class="cx"> /** This action is documented in wp-includes/post.php */
</span><span class="cx"> do_action( 'save_post', $post->ID, $post, true );
</span><ins>+
</ins><span class="cx"> /** This action is documented in wp-includes/post.php */
</span><span class="cx"> do_action( 'wp_insert_post', $post->ID, $post, true );
</span><span class="cx"> }
</span><span class="lines">@@ -3585,9 +3619,10 @@
</span><span class="cx"> * @since 2.5.0
</span><span class="cx"> *
</span><span class="cx"> * @param int|WP_Post $post_id Post ID or post object.
</span><del>- * @return null Nothing is returned. Which can mean that no action is required or post was published.
</del><ins>+ * @return null Nothing is returned. Which can mean that no action is required
+ * or post was published.
</ins><span class="cx"> */
</span><del>-function check_and_publish_future_post($post_id) {
</del><ins>+function check_and_publish_future_post( $post_id ) {
</ins><span class="cx">
</span><span class="cx"> $post = get_post($post_id);
</span><span class="cx">
</span><span class="lines">@@ -3613,14 +3648,15 @@
</span><span class="cx"> *
</span><span class="cx"> * @since 2.8.0
</span><span class="cx"> *
</span><del>- * @global wpdb $wpdb
</del><ins>+ * @global wpdb $wpdb WordPress database abstraction object.
</ins><span class="cx"> * @global WP_Rewrite $wp_rewrite
</span><del>- * @param string $slug the desired slug (post_name)
- * @param integer $post_ID
- * @param string $post_status no uniqueness checks are made if the post is still draft or pending
- * @param string $post_type
- * @param integer $post_parent
- * @return string unique slug for the post, based on $post_name (with a -1, -2, etc. suffix)
</del><ins>+ *
+ * @param string $slug The desired slug (post_name).
+ * @param int $post_ID Post ID.
+ * @param string $post_status No uniqueness checks are made if the post is still draft or pending.
+ * @param string $post_type Post type.
+ * @param int $post_parent Post parent ID.
+ * @return string Unique slug for the post, based on $post_name (with a -1, -2, etc. suffix)
</ins><span class="cx"> */
</span><span class="cx"> function wp_unique_post_slug( $slug, $post_ID, $post_status, $post_type, $post_parent ) {
</span><span class="cx"> if ( in_array( $post_status, array( 'draft', 'pending', 'auto-draft' ) ) || ( 'inherit' == $post_status && 'revision' == $post_type ) )
</span><span class="lines">@@ -3728,14 +3764,15 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><del>- * Truncates a post slug.
</del><ins>+ * Truncate a post slug.
</ins><span class="cx"> *
</span><span class="cx"> * @since 3.6.0
</span><span class="cx"> * @access private
</span><del>- * @uses utf8_uri_encode() Makes sure UTF-8 characters are properly cut and encoded.
</del><span class="cx"> *
</span><del>- * @param string $slug The slug to truncate.
- * @param int $length Max length of the slug.
</del><ins>+ * @see utf8_uri_encode()
+ *
+ * @param string $slug The slug to truncate.
+ * @param int $length Optional. Max length of the slug. Default 200 (characters).
</ins><span class="cx"> * @return string The truncated slug.
</span><span class="cx"> */
</span><span class="cx"> function _truncate_post_slug( $slug, $length = 200 ) {
</span><span class="lines">@@ -3751,15 +3788,16 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><del>- * Adds tags to a post.
</del><ins>+ * Add tags to a post.
</ins><span class="cx"> *
</span><del>- * @uses wp_set_post_tags() Same first two parameters, but the last parameter is always set to true.
</del><ins>+ * @see wp_set_post_tags()
</ins><span class="cx"> *
</span><span class="cx"> * @since 2.3.0
</span><span class="cx"> *
</span><del>- * @param int $post_id Optional. The Post ID. Does not default to the ID of the global $post.
- * @param string $tags The tags to set for the post, separated by commas.
- * @return bool|null Will return false if $post_id is not an integer or is 0. Will return null otherwise
</del><ins>+ * @param int $post_id Optional. The Post ID. Does not default to the ID of the global $post.
+ * Default 0.
+ * @param string $tags Optional. The tags to set for the post, separated by commas. Default empty.
+ * @return bool|null Will return false if $post_id is not an integer or is 0. Will return null otherwise.
</ins><span class="cx"> */
</span><span class="cx"> function wp_add_post_tags( $post_id = 0, $tags = '' ) {
</span><span class="cx"> return wp_set_post_tags($post_id, $tags, true);
</span><span class="lines">@@ -3769,11 +3807,14 @@
</span><span class="cx"> * Set the tags for a post.
</span><span class="cx"> *
</span><span class="cx"> * @since 2.3.0
</span><del>- * @uses wp_set_object_terms() Sets the tags for the post.
</del><span class="cx"> *
</span><del>- * @param int $post_id Optional. The Post ID. Does not default to the ID of the global $post.
- * @param string $tags The tags to set for the post, separated by commas.
- * @param bool $append If true, don't delete existing tags, just add on. If false, replace the tags with the new tags.
</del><ins>+ * @see wp_set_object_terms()
+ *
+ * @param int $post_id Optional. The Post ID. Does not default to the ID of the global $post.
+ * @param string $tags Optional. The tags to set for the post, separated by commas.
+ * Default empty.
+ * @param bool $append Optional. If true, don't delete existing tags, just add on. If false,
+ * replace the tags with the new tags. Default false.
</ins><span class="cx"> * @return mixed Array of affected term IDs. WP_Error or false on failure.
</span><span class="cx"> */
</span><span class="cx"> function wp_set_post_tags( $post_id = 0, $tags = '', $append = false ) {
</span><span class="lines">@@ -3784,12 +3825,14 @@
</span><span class="cx"> * Set the terms for a post.
</span><span class="cx"> *
</span><span class="cx"> * @since 2.8.0
</span><del>- * @uses wp_set_object_terms() Sets the tags for the post.
</del><span class="cx"> *
</span><ins>+ * @see wp_set_object_terms()
+ *
</ins><span class="cx"> * @param int $post_id Optional. The Post ID. Does not default to the ID of the global $post.
</span><del>- * @param string $tags The tags to set for the post, separated by commas.
- * @param string $taxonomy Taxonomy name. Defaults to 'post_tag'.
- * @param bool $append If true, don't delete existing tags, just add on. If false, replace the tags with the new tags.
</del><ins>+ * @param string $tags Optional. The tags to set for the post, separated by commas. Default empty.
+ * @param string $taxonomy Optional. Taxonomy name. Default 'post_tag'.
+ * @param bool $append Optional. If true, don't delete existing tags, just add on. If false,
+ * replace the tags with the new tags. Default false.
</ins><span class="cx"> * @return mixed Array of affected term IDs. WP_Error or false on failure.
</span><span class="cx"> */
</span><span class="cx"> function wp_set_post_terms( $post_id = 0, $tags = '', $taxonomy = 'post_tag', $append = false ) {
</span><span class="lines">@@ -3808,8 +3851,10 @@
</span><span class="cx"> $tags = explode( ',', trim( $tags, " \n\t\r\0\x0B," ) );
</span><span class="cx"> }
</span><span class="cx">
</span><del>- // Hierarchical taxonomies must always pass IDs rather than names so that children with the same
- // names but different parents aren't confused.
</del><ins>+ /*
+ * Hierarchical taxonomies must always pass IDs rather than names so that
+ * children with the same names but different parents aren't confused.
+ */
</ins><span class="cx"> if ( is_taxonomy_hierarchical( $taxonomy ) ) {
</span><span class="cx"> $tags = array_unique( array_map( 'intval', $tags ) );
</span><span class="cx"> }
</span><span class="lines">@@ -3825,9 +3870,12 @@
</span><span class="cx"> *
</span><span class="cx"> * @since 2.1.0
</span><span class="cx"> *
</span><del>- * @param int $post_ID Optional. The Post ID. Does not default to the ID of the global $post.
</del><ins>+ * @param int $post_ID Optional. The Post ID. Does not default to the ID
+ * of the global $post. Default 0.
</ins><span class="cx"> * @param array|int $post_categories Optional. List of categories or ID of category.
</span><del>- * @param bool $append If true, don't delete existing categories, just add on. If false, replace the categories with the new categories.
</del><ins>+ * Default empty array.
+ * @param bool $append If true, don't delete existing categories, just add on.
+ * If false, replace the categories with the new categories.
</ins><span class="cx"> * @return bool|mixed
</span><span class="cx"> */
</span><span class="cx"> function wp_set_post_categories( $post_ID = 0, $post_categories = array(), $append = false ) {
</span><span class="lines">@@ -3866,13 +3914,11 @@
</span><span class="cx"> *
</span><span class="cx"> * @since 2.3.0
</span><span class="cx"> *
</span><del>- * @link http://codex.wordpress.org/Post_Status_Transitions
- *
</del><span class="cx"> * @param string $new_status Transition to this post status.
</span><span class="cx"> * @param string $old_status Previous post status.
</span><span class="cx"> * @param object $post Post data.
</span><span class="cx"> */
</span><del>-function wp_transition_post_status($new_status, $old_status, $post) {
</del><ins>+function wp_transition_post_status( $new_status, $old_status, $post ) {
</ins><span class="cx"> /**
</span><span class="cx"> * Fires when a post is transitioned from one status to another.
</span><span class="cx"> *
</span><span class="lines">@@ -3915,16 +3961,17 @@
</span><span class="cx"> //
</span><span class="cx">
</span><span class="cx"> /**
</span><del>- * Add a URL to those already pung.
</del><ins>+ * Add a URL to those already pinged.
</ins><span class="cx"> *
</span><span class="cx"> * @since 1.5.0
</span><del>- * @uses $wpdb
</del><span class="cx"> *
</span><del>- * @param int $post_id Post ID.
- * @param string $uri Ping URI.
</del><ins>+ * @global wpdb $wpdb WordPress database abstraction object.
+ *
+ * @param int $post_id Post ID.
+ * @param string $uri Ping URI.
</ins><span class="cx"> * @return int How many rows were updated.
</span><span class="cx"> */
</span><del>-function add_ping($post_id, $uri) {
</del><ins>+function add_ping( $post_id, $uri ) {
</ins><span class="cx"> global $wpdb;
</span><span class="cx"> $pung = $wpdb->get_var( $wpdb->prepare( "SELECT pinged FROM $wpdb->posts WHERE ID = %d", $post_id ));
</span><span class="cx"> $pung = trim($pung);
</span><span class="lines">@@ -3952,9 +3999,9 @@
</span><span class="cx"> * @since 1.5.0
</span><span class="cx"> *
</span><span class="cx"> * @param int $post_id Post ID.
</span><del>- * @return array List of enclosures
</del><ins>+ * @return array List of enclosures.
</ins><span class="cx"> */
</span><del>-function get_enclosed($post_id) {
</del><ins>+function get_enclosed( $post_id ) {
</ins><span class="cx"> $custom_fields = get_post_custom( $post_id );
</span><span class="cx"> $pung = array();
</span><span class="cx"> if ( !is_array( $custom_fields ) )
</span><span class="lines">@@ -3985,12 +4032,13 @@
</span><span class="cx"> * Retrieve URLs already pinged for a post.
</span><span class="cx"> *
</span><span class="cx"> * @since 1.5.0
</span><del>- * @uses $wpdb
</del><span class="cx"> *
</span><ins>+ * @global wpdb $wpdb WordPress database abstraction object.
+ *
</ins><span class="cx"> * @param int $post_id Post ID.
</span><span class="cx"> * @return array
</span><span class="cx"> */
</span><del>-function get_pung($post_id) {
</del><ins>+function get_pung( $post_id ) {
</ins><span class="cx"> global $wpdb;
</span><span class="cx"> $pung = $wpdb->get_var( $wpdb->prepare( "SELECT pinged FROM $wpdb->posts WHERE ID = %d", $post_id ));
</span><span class="cx"> $pung = trim($pung);
</span><span class="lines">@@ -4011,12 +4059,13 @@
</span><span class="cx"> * Retrieve URLs that need to be pinged.
</span><span class="cx"> *
</span><span class="cx"> * @since 1.5.0
</span><del>- * @uses $wpdb
</del><span class="cx"> *
</span><ins>+ * @global wpdb $wpdb WordPress database abstraction object.
+ *
</ins><span class="cx"> * @param int $post_id Post ID
</span><span class="cx"> * @return array
</span><span class="cx"> */
</span><del>-function get_to_ping($post_id) {
</del><ins>+function get_to_ping( $post_id ) {
</ins><span class="cx"> global $wpdb;
</span><span class="cx"> $to_ping = $wpdb->get_var( $wpdb->prepare( "SELECT to_ping FROM $wpdb->posts WHERE ID = %d", $post_id ));
</span><span class="cx"> $to_ping = sanitize_trackback_urls( $to_ping );
</span><span class="lines">@@ -4038,8 +4087,8 @@
</span><span class="cx"> *
</span><span class="cx"> * @since 1.0.0
</span><span class="cx"> *
</span><del>- * @param string $tb_list Comma separated list of URLs
- * @param int $post_id Post ID
</del><ins>+ * @param string $tb_list Comma separated list of URLs.
+ * @param int $post_id Post ID.
</ins><span class="cx"> */
</span><span class="cx"> function trackback_url_list( $tb_list, $post_id ) {
</span><span class="cx"> if ( ! empty( $tb_list ) ) {
</span><span class="lines">@@ -4069,8 +4118,9 @@
</span><span class="cx"> * Get a list of page IDs.
</span><span class="cx"> *
</span><span class="cx"> * @since 2.0.0
</span><del>- * @uses $wpdb
</del><span class="cx"> *
</span><ins>+ * @global wpdb $wpdb WordPress database abstraction object.
+ *
</ins><span class="cx"> * @return array List of page IDs.
</span><span class="cx"> */
</span><span class="cx"> function get_all_page_ids() {
</span><span class="lines">@@ -4091,12 +4141,14 @@
</span><span class="cx"> * Use get_post() instead of get_page().
</span><span class="cx"> *
</span><span class="cx"> * @since 1.5.1
</span><del>- * @deprecated 3.5.0
</del><ins>+ * @deprecated 3.5.0 Use get_post()
</ins><span class="cx"> *
</span><del>- * @param mixed $page Page object or page ID. Passed by reference.
- * @param string $output What to output. OBJECT, ARRAY_A, or ARRAY_N.
- * @param string $filter How the return value should be filtered.
- * @return WP_Post|null WP_Post on success or null on failure
</del><ins>+ * @param mixed $page Page object or page ID. Passed by reference.
+ * @param string $output Optional. What to output. Accepts OBJECT, ARRAY_A, or ARRAY_N.
+ * Default OBJECT.
+ * @param string $filter Optional. How the return value should be filtered. Accepts 'raw',
+ * 'edit', 'db', 'display'. Default 'raw'.
+ * @return WP_Post|null WP_Post on success or null on failure.
</ins><span class="cx"> */
</span><span class="cx"> function get_page( $page, $output = OBJECT, $filter = 'raw') {
</span><span class="cx"> return get_post( $page, $output, $filter );
</span><span class="lines">@@ -4106,12 +4158,14 @@
</span><span class="cx"> * Retrieves a page given its path.
</span><span class="cx"> *
</span><span class="cx"> * @since 2.1.0
</span><del>- * @uses $wpdb
</del><span class="cx"> *
</span><del>- * @param string $page_path Page path
- * @param string $output Optional. Output type. OBJECT, ARRAY_N, or ARRAY_A. Default OBJECT.
- * @param string|array $post_type Optional. Post type or array of post types. Default page.
- * @return WP_Post|null WP_Post on success or null on failure
</del><ins>+ * @global wpdb $wpdb WordPress database abstraction object.
+ *
+ * @param string $page_path Page path.
+ * @param string $output Optional. Output type. Accepts OBJECT, ARRAY_N, or ARRAY_A.
+ * Default OBJECT.
+ * @param string|array $post_type Optional. Post type or array of post types. Default 'page'.
+ * @return WP_Post|null WP_Post on success or null on failure.
</ins><span class="cx"> */
</span><span class="cx"> function get_page_by_path( $page_path, $output = OBJECT, $post_type = 'page' ) {
</span><span class="cx"> global $wpdb;
</span><span class="lines">@@ -4175,11 +4229,13 @@
</span><span class="cx"> * Retrieve a page given its title.
</span><span class="cx"> *
</span><span class="cx"> * @since 2.1.0
</span><del>- * @uses $wpdb
</del><span class="cx"> *
</span><del>- * @param string $page_title Page title
- * @param string $output Optional. Output type. OBJECT, ARRAY_N, or ARRAY_A. Default OBJECT.
- * @param string|array $post_type Optional. Post type or array of post types. Default page.
</del><ins>+ * @global wpdb $wpdb WordPress database abstraction object.
+ *
+ * @param string $page_title Page title
+ * @param string $output Optional. Output type. OBJECT, ARRAY_N, or ARRAY_A.
+ * Default OBJECT.
+ * @param string|array $post_type Optional. Post type or array of post types. Default 'page'.
</ins><span class="cx"> * @return WP_Post|null WP_Post on success or null on failure
</span><span class="cx"> */
</span><span class="cx"> function get_page_by_title( $page_title, $output = OBJECT, $post_type = 'page' ) {
</span><span class="lines">@@ -4220,9 +4276,9 @@
</span><span class="cx"> *
</span><span class="cx"> * @since 1.5.1
</span><span class="cx"> *
</span><del>- * @param int $page_id Page ID.
- * @param array $pages List of pages' objects.
- * @return array
</del><ins>+ * @param int $page_id Page ID.
+ * @param array $pages List of pages' objects.
+ * @return array List of page children.
</ins><span class="cx"> */
</span><span class="cx"> function get_page_children($page_id, $pages) {
</span><span class="cx"> $page_list = array();
</span><span class="lines">@@ -4244,8 +4300,8 @@
</span><span class="cx"> *
</span><span class="cx"> * @since 2.0.0
</span><span class="cx"> *
</span><del>- * @param array $pages Posts array.
- * @param int $page_id Parent page ID.
</del><ins>+ * @param array $pages Posts array, passed by reference.
+ * @param int $page_id Optional. Parent page ID. Default 0.
</ins><span class="cx"> * @return array A list arranged by hierarchy. Children immediately follow their parents.
</span><span class="cx"> */
</span><span class="cx"> function get_page_hierarchy( &$pages, $page_id = 0 ) {
</span><span class="lines">@@ -4267,10 +4323,17 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><del>- * function to traverse and return all the nested children post names of a root page.
</del><ins>+ * Traverse and return all the nested children post names of a root page.
+ *
</ins><span class="cx"> * $children contains parent-children relations
</span><span class="cx"> *
</span><span class="cx"> * @since 2.9.0
</span><ins>+ *
+ * @see _page_traverse_name()
+ *
+ * @param int $page_id Page ID.
+ * @param array &$children Parent-children relations, passed by reference.
+ * @param array &$result Result, passed by reference.
</ins><span class="cx"> */
</span><span class="cx"> function _page_traverse_name( $page_id, &$children, &$result ){
</span><span class="cx"> if ( isset( $children[ $page_id ] ) ){
</span><span class="lines">@@ -4282,13 +4345,13 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><del>- * Builds URI for a page.
</del><ins>+ * Build URI for a page.
</ins><span class="cx"> *
</span><span class="cx"> * Sub pages will be in the "directory" under the parent page post name.
</span><span class="cx"> *
</span><span class="cx"> * @since 1.5.0
</span><span class="cx"> *
</span><del>- * @param mixed $page Page object or page ID.
</del><ins>+ * @param WP_Post|object|int $page Page object or page ID.
</ins><span class="cx"> * @return string|false Page URI, false on error.
</span><span class="cx"> */
</span><span class="cx"> function get_page_uri( $page ) {
</span><span class="lines">@@ -4309,7 +4372,7 @@
</span><span class="cx"> /**
</span><span class="cx"> * Retrieve a list of pages.
</span><span class="cx"> *
</span><del>- * @global wpdb $wpdb WordPress database abstraction object
</del><ins>+ * @global wpdb $wpdb WordPress database abstraction object.
</ins><span class="cx"> *
</span><span class="cx"> * @since 1.5.0
</span><span class="cx"> *
</span><span class="lines">@@ -5151,7 +5214,7 @@
</span><span class="cx"> /**
</span><span class="cx"> * Retrieve the post SQL based on capability, author, and type.
</span><span class="cx"> *
</span><del>- * @see get_private_posts_cap_sql() for full description.
</del><ins>+ * @see get_private_posts_cap_sql()
</ins><span class="cx"> *
</span><span class="cx"> * @since 3.0.0
</span><span class="cx"> * @param string $post_type Post type.
</span></span></pre>
</div>
</div>
</body>
</html>