<!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>[28106] trunk/src/wp-includes/post.php: Part II of inline documentation for hooks 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/28106">28106</a></dd>
<dt>Author</dt> <dd>DrewAPicture</dd>
<dt>Date</dt> <dd>2014-04-13 23:05:20 +0000 (Sun, 13 Apr 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>Part II of inline documentation for hooks in wp-includes/post.php.
Documents all remaining hooks following <a href="http://core.trac.wordpress.org/changeset/28041">[28041]</a> and <a href="http://core.trac.wordpress.org/changeset/28042">[28042]</a>. Also updates the hash notation style for `wp_insert_post()`.
Props nacin for several hook descriptions.
Fixes <a href="http://core.trac.wordpress.org/ticket/25376">#25376</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 (28105 => 28106)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-includes/post.php 2014-04-13 19:01:21 UTC (rev 28105)
+++ trunk/src/wp-includes/post.php 2014-04-13 23:05:20 UTC (rev 28106)
</span><span class="lines">@@ -1351,6 +1351,14 @@
</span><span class="cx"> register_taxonomy_for_object_type( $taxonomy, $post_type );
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ /**
+ * Fires after a post type is registered.
+ *
+ * @since 3.3.0
+ *
+ * @param string $post_type Post type.
+ * @param array $args Arguments used to register the post type.
+ */
</ins><span class="cx"> do_action( 'registered_post_type', $post_type, $args );
</span><span class="cx">
</span><span class="cx"> return $args;
</span><span class="lines">@@ -2401,8 +2409,7 @@
</span><span class="cx"> * disabled, item is already in the trash, or $force_delete is true.
</span><span class="cx"> *
</span><span class="cx"> * @since 1.0.0
</span><del>- * @uses do_action() on 'delete_post' before deletion unless post type is 'attachment'.
- * @uses do_action() on 'deleted_post' after deletion unless post type is 'attachment'.
</del><ins>+ *
</ins><span class="cx"> * @uses wp_delete_attachment() if post type is 'attachment'.
</span><span class="cx"> * @uses wp_trash_post() if item should be trashed.
</span><span class="cx"> *
</span><span class="lines">@@ -2422,7 +2429,16 @@
</span><span class="cx"> if ( $post->post_type == 'attachment' )
</span><span class="cx"> return wp_delete_attachment( $postid, $force_delete );
</span><span class="cx">
</span><del>- do_action('before_delete_post', $postid);
</del><ins>+ /**
+ * Fires before a post is deleted, at the start of wp_delete_post().
+ *
+ * @since 3.2.0
+ *
+ * @see wp_delete_post()
+ *
+ * @param int $postid Post ID.
+ */
+ do_action( 'before_delete_post', $postid );
</ins><span class="cx">
</span><span class="cx"> delete_post_meta($postid,'_wp_trash_meta_status');
</span><span class="cx"> delete_post_meta($postid,'_wp_trash_meta_time');
</span><span class="lines">@@ -2457,11 +2473,26 @@
</span><span class="cx"> foreach ( $post_meta_ids as $mid )
</span><span class="cx"> delete_metadata_by_mid( 'post', $mid );
</span><span class="cx">
</span><ins>+ /**
+ * Fires immediately before a post is deleted from the database.
+ *
+ * @since 1.2.0
+ *
+ * @param int $postid Post ID.
+ */
</ins><span class="cx"> do_action( 'delete_post', $postid );
</span><span class="cx"> $result = $wpdb->delete( $wpdb->posts, array( 'ID' => $postid ) );
</span><span class="cx"> if ( ! $result ) {
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><ins>+
+ /**
+ * Fires immediately after a post is deleted from the database.
+ *
+ * @since 2.2.0
+ *
+ * @param int $postid Post ID.
+ */
</ins><span class="cx"> do_action( 'deleted_post', $postid );
</span><span class="cx">
</span><span class="cx"> clean_post_cache( $post );
</span><span class="lines">@@ -2473,7 +2504,16 @@
</span><span class="cx">
</span><span class="cx"> wp_clear_scheduled_hook('publish_future_post', array( $postid ) );
</span><span class="cx">
</span><del>- do_action('after_delete_post', $postid);
</del><ins>+ /**
+ * Fires after a post is deleted, at the conclusion of wp_delete_post().
+ *
+ * @since 3.2.0
+ *
+ * @see wp_delete_post()
+ *
+ * @param int $postid Post ID.
+ */
+ do_action( 'after_delete_post', $postid );
</ins><span class="cx">
</span><span class="cx"> return $post;
</span><span class="cx"> }
</span><span class="lines">@@ -2512,8 +2552,7 @@
</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><del>- * @uses do_action() on 'trash_post' before trashing
- * @uses do_action() on 'trashed_post' after trashing
</del><ins>+ *
</ins><span class="cx"> * @uses wp_delete_post() if trash is disabled
</span><span class="cx"> *
</span><span class="cx"> * @param int $post_id Post ID.
</span><span class="lines">@@ -2529,7 +2568,14 @@
</span><span class="cx"> if ( $post['post_status'] == 'trash' )
</span><span class="cx"> return false;
</span><span class="cx">
</span><del>- do_action('wp_trash_post', $post_id);
</del><ins>+ /**
+ * Fires before a post is sent to the trash.
+ *
+ * @since 3.3.0
+ *
+ * @param int $post_id Post ID.
+ */
+ do_action( 'wp_trash_post', $post_id );
</ins><span class="cx">
</span><span class="cx"> add_post_meta($post_id,'_wp_trash_meta_status', $post['post_status']);
</span><span class="cx"> add_post_meta($post_id,'_wp_trash_meta_time', time());
</span><span class="lines">@@ -2539,7 +2585,14 @@
</span><span class="cx">
</span><span class="cx"> wp_trash_post_comments($post_id);
</span><span class="cx">
</span><del>- do_action('trashed_post', $post_id);
</del><ins>+ /**
+ * Fires after a post is sent to the trash.
+ *
+ * @since 2.9.0
+ *
+ * @param int $post_id Post ID.
+ */
+ do_action( 'trashed_post', $post_id );
</ins><span class="cx">
</span><span class="cx"> return $post;
</span><span class="cx"> }
</span><span class="lines">@@ -2548,8 +2601,6 @@
</span><span class="cx"> * Restores a post or page from the Trash
</span><span class="cx"> *
</span><span class="cx"> * @since 2.9.0
</span><del>- * @uses do_action() on 'untrash_post' before undeletion
- * @uses do_action() on 'untrashed_post' after undeletion
</del><span class="cx"> *
</span><span class="cx"> * @param int $post_id Post ID.
</span><span class="cx"> * @return mixed False on failure
</span><span class="lines">@@ -2561,7 +2612,14 @@
</span><span class="cx"> if ( $post['post_status'] != 'trash' )
</span><span class="cx"> return false;
</span><span class="cx">
</span><del>- do_action('untrash_post', $post_id);
</del><ins>+ /**
+ * Fires before a post is restored from the trash.
+ *
+ * @since 2.9.0
+ *
+ * @param int $post_id Post ID.
+ */
+ do_action( 'untrash_post', $post_id );
</ins><span class="cx">
</span><span class="cx"> $post_status = get_post_meta($post_id, '_wp_trash_meta_status', true);
</span><span class="cx">
</span><span class="lines">@@ -2574,7 +2632,14 @@
</span><span class="cx">
</span><span class="cx"> wp_untrash_post_comments($post_id);
</span><span class="cx">
</span><del>- do_action('untrashed_post', $post_id);
</del><ins>+ /**
+ * Fires after a post is restored from the trash.
+ *
+ * @since 2.9.0
+ *
+ * @param int $post_id Post ID.
+ */
+ do_action( 'untrashed_post', $post_id );
</ins><span class="cx">
</span><span class="cx"> return $post;
</span><span class="cx"> }
</span><span class="lines">@@ -2583,8 +2648,6 @@
</span><span class="cx"> * Moves comments for a post to the trash
</span><span class="cx"> *
</span><span class="cx"> * @since 2.9.0
</span><del>- * @uses do_action() on 'trash_post_comments' before trashing
- * @uses do_action() on 'trashed_post_comments' after trashing
</del><span class="cx"> *
</span><span class="cx"> * @param int|WP_Post $post Optional. Post ID or post object.
</span><span class="cx"> * @return mixed False on failure
</span><span class="lines">@@ -2598,7 +2661,14 @@
</span><span class="cx">
</span><span class="cx"> $post_id = $post->ID;
</span><span class="cx">
</span><del>- do_action('trash_post_comments', $post_id);
</del><ins>+ /**
+ * Fires before comments are sent to the trash.
+ *
+ * @since 2.9.0
+ *
+ * @param int $post_id Post ID.
+ */
+ do_action( 'trash_post_comments', $post_id );
</ins><span class="cx">
</span><span class="cx"> $comments = $wpdb->get_results( $wpdb->prepare("SELECT comment_ID, comment_approved FROM $wpdb->comments WHERE comment_post_ID = %d", $post_id) );
</span><span class="cx"> if ( empty($comments) )
</span><span class="lines">@@ -2615,7 +2685,15 @@
</span><span class="cx">
</span><span class="cx"> clean_comment_cache( array_keys($statuses) );
</span><span class="cx">
</span><del>- do_action('trashed_post_comments', $post_id, $statuses);
</del><ins>+ /**
+ * Fires after comments are sent to the trash.
+ *
+ * @since 2.9.0
+ *
+ * @param int $post_id Post ID.
+ * @param array $statuses Array of comment statuses.
+ */
+ do_action( 'trashed_post_comments', $post_id, $statuses );
</ins><span class="cx">
</span><span class="cx"> return $result;
</span><span class="cx"> }
</span><span class="lines">@@ -2624,8 +2702,6 @@
</span><span class="cx"> * Restore comments for a post from the trash
</span><span class="cx"> *
</span><span class="cx"> * @since 2.9.0
</span><del>- * @uses do_action() on 'untrash_post_comments' before trashing
- * @uses do_action() on 'untrashed_post_comments' after trashing
</del><span class="cx"> *
</span><span class="cx"> * @param int|WP_Post $post Optional. Post ID or post object.
</span><span class="cx"> * @return mixed False on failure
</span><span class="lines">@@ -2644,7 +2720,14 @@
</span><span class="cx"> if ( empty($statuses) )
</span><span class="cx"> return true;
</span><span class="cx">
</span><del>- do_action('untrash_post_comments', $post_id);
</del><ins>+ /**
+ * Fires before comments are restored for a post from the trash.
+ *
+ * @since 2.9.0
+ *
+ * @param int $post_id Post ID.
+ */
+ do_action( 'untrash_post_comments', $post_id );
</ins><span class="cx">
</span><span class="cx"> // Restore each comment to its original status
</span><span class="cx"> $group_by_status = array();
</span><span class="lines">@@ -2663,7 +2746,14 @@
</span><span class="cx">
</span><span class="cx"> delete_post_meta($post_id, '_wp_trash_meta_comments_status');
</span><span class="cx">
</span><del>- do_action('untrashed_post_comments', $post_id);
</del><ins>+ /**
+ * Fires after comments are restored for a post from the trash.
+ *
+ * @since 2.9.0
+ *
+ * @param int $post_id Post ID.
+ */
+ do_action( 'untrashed_post_comments', $post_id );
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><span class="lines">@@ -2797,21 +2887,21 @@
</span><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.
- * @type string 'post_status' The post status. Default 'draft'.
- * @type string 'post_type' The post type. Default 'post'.
- * @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.
- * @type int 'post_parent' Set this for the post it belongs to, if any. Default 0.
- * @type int 'menu_order' The order it is displayed. Default 0.
- * @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.
- * Default empty string.
- * @type string 'post_password The password to access the post. Default empty string.
- * @type string 'guid' Global Unique ID for referencing the post.
- * @type string 'post_content_filtered' The filtered post content. Default empty string.
- * @type string 'post_excerpt' The post excerpt. Default empty string.
</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.
+ * @type string $post_status The post status. Default 'draft'.
+ * @type string $post_type The post type. Default 'post'.
+ * @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.
+ * @type int $post_parent Set this for the post it belongs to, if any. Default 0.
+ * @type int $menu_order The order it is displayed. Default 0.
+ * @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.
+ * Default empty string.
+ * @type string $post_password The password to access the post. Default empty string.
+ * @type string $guid' Global Unique ID for referencing the post.
+ * @type string $post_content_filtered The filtered post content. Default empty string.
+ * @type string $post_excerpt The post excerpt. Default empty string.
</ins><span class="cx"> * }
</span><span class="cx"> * @param bool $wp_error Optional. Allow return of WP_Error on failure.
</span><span class="cx"> * @return int|WP_Error The post ID on success. The value 0 or WP_Error on failure.
</span><span class="lines">@@ -2987,7 +3077,16 @@
</span><span class="cx"> else
</span><span class="cx"> $post_parent = 0;
</span><span class="cx">
</span><del>- // Check the post_parent to see if it will cause a hierarchy loop
</del><ins>+ /**
+ * Filter the post parent -- used to check for and prevent hierarchy loops.
+ *
+ * @since 3.1.0
+ *
+ * @param int $post_parent Post parent ID.
+ * @param int $post_ID Post ID.
+ * @param array $new_postarr Array of parsed post data.
+ * @param array $postarr Array of sanitized, but otherwise unmodified post data.
+ */
</ins><span class="cx"> $post_parent = apply_filters( 'wp_insert_post_parent', $post_parent, $post_ID, compact( array_keys( $postarr ) ), $postarr );
</span><span class="cx">
</span><span class="cx"> if ( isset($menu_order) )
</span><span class="lines">@@ -3002,11 +3101,28 @@
</span><span class="cx">
</span><span class="cx"> // expected_slashed (everything!)
</span><span class="cx"> $data = compact( array( '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', 'guid' ) );
</span><del>- $data = apply_filters('wp_insert_post_data', $data, $postarr);
</del><ins>+
+ /**
+ * Filter slashed post data just before it is inserted into the database.
+ *
+ * @since 2.7.0
+ *
+ * @param array $data Array of slashed post data.
+ * @param array $postarr Array of sanitized, but otherwise unmodified post data.
+ */
+ $data = apply_filters( 'wp_insert_post_data', $data, $postarr );
</ins><span class="cx"> $data = wp_unslash( $data );
</span><span class="cx"> $where = array( 'ID' => $post_ID );
</span><span class="cx">
</span><span class="cx"> if ( $update ) {
</span><ins>+ /**
+ * Fires immediately before an existing post is updated in the database.
+ *
+ * @since 2.5.0
+ *
+ * @param int $post_ID Post ID.
+ * @param array $data Array of unslashed post data.
+ */
</ins><span class="cx"> do_action( 'pre_post_update', $post_ID, $data );
</span><span class="cx"> if ( false === $wpdb->update( $wpdb->posts, $data, $where ) ) {
</span><span class="cx"> if ( $wp_error )
</span><span class="lines">@@ -3083,13 +3199,63 @@
</span><span class="cx"> wp_transition_post_status($data['post_status'], $previous_status, $post);
</span><span class="cx">
</span><span class="cx"> if ( $update ) {
</span><del>- do_action('edit_post', $post_ID, $post);
</del><ins>+ /**
+ * Fires once an existing post has been updated.
+ *
+ * @since 1.2.0
+ *
+ * @param int $post_ID Post ID.
+ * @param WP_Post $post Post object.
+ */
+ do_action( 'edit_post', $post_ID, $post );
</ins><span class="cx"> $post_after = get_post($post_ID);
</span><ins>+
+ /**
+ * Fires once an existing post has been updated.
+ *
+ * @since 3.0.0
+ *
+ * @param int $post_ID Post ID.
+ * @param WP_Post $post_after Post object following the update.
+ * @param WP_Post $post_before Post object before the update.
+ */
</ins><span class="cx"> do_action( 'post_updated', $post_ID, $post_after, $post_before);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ /**
+ * Fires once a post has been saved.
+ *
+ * The dynamic portion of the hook name, $post->post_type, refers to
+ * the post type slug.
+ *
+ * @since 3.7.0
+ *
+ * @param int $post_ID Post ID.
+ * @param WP_Post $post Post object.
+ * @param bool $update Whether this is an existing post being updated or not.
+ */
</ins><span class="cx"> do_action( "save_post_{$post->post_type}", $post_ID, $post, $update );
</span><ins>+
+ /**
+ * Fires once a post has been saved.
+ *
+ * @since 1.5.0
+ *
+ * @param int $post_ID Post ID.
+ * @param WP_Post $post Post object.
+ * @param bool $update Whether this is an existing post being updated or not.
+ */
</ins><span class="cx"> do_action( 'save_post', $post_ID, $post, $update );
</span><ins>+
+ /**
+ * Fires once a post has been saved.
+ *
+ * @since 2.0.0
+ *
+ * @param int $post_ID Post ID.
+ * @param WP_Post $post Post object.
+ * @param bool $update Whether this is an existing post being updated or not.
+ */
</ins><span class="cx"> do_action( 'wp_insert_post', $post_ID, $post, $update );
</span><span class="cx">
</span><span class="cx"> return $post_ID;
</span><span class="lines">@@ -3159,7 +3325,6 @@
</span><span class="cx"> *
</span><span class="cx"> * @since 2.1.0
</span><span class="cx"> * @uses $wpdb
</span><del>- * @uses do_action() Calls 'edit_post', 'save_post_{$post_type}', 'save_post' and 'wp_insert_post' on post_id and post data.
</del><span class="cx"> *
</span><span class="cx"> * @param int|WP_Post $post Post ID or post object.
</span><span class="cx"> */
</span><span class="lines">@@ -3180,9 +3345,13 @@
</span><span class="cx"> $post->post_status = 'publish';
</span><span class="cx"> wp_transition_post_status( 'publish', $old_status, $post );
</span><span class="cx">
</span><ins>+ /** This action is documented in wp-includes/post.php */
</ins><span class="cx"> do_action( 'edit_post', $post->ID, $post );
</span><ins>+ /** This action is documented in wp-includes/post.php */
</ins><span class="cx"> do_action( "save_post_{$post->post_type}", $post->ID, $post, true );
</span><ins>+ /** This action is documented in wp-includes/post.php */
</ins><span class="cx"> do_action( 'save_post', $post->ID, $post, true );
</span><ins>+ /** This action is documented in wp-includes/post.php */
</ins><span class="cx"> do_action( 'wp_insert_post', $post->ID, $post, true );
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -3250,6 +3419,14 @@
</span><span class="cx"> $check_sql = "SELECT post_name FROM $wpdb->posts WHERE post_name = %s AND ID != %d LIMIT 1";
</span><span class="cx"> $post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $slug, $post_ID ) );
</span><span class="cx">
</span><ins>+ /**
+ * Filter whether the post slug would make a bad attachment slug.
+ *
+ * @since 3.1.0
+ *
+ * @param bool $bad_slug Whether the slug would be bad as an attachment slug.
+ * @param string $slug The post slug.
+ */
</ins><span class="cx"> if ( $post_name_check || in_array( $slug, $feeds ) || apply_filters( 'wp_unique_post_slug_is_bad_attachment_slug', false, $slug ) ) {
</span><span class="cx"> $suffix = 2;
</span><span class="cx"> do {
</span><span class="lines">@@ -3262,11 +3439,24 @@
</span><span class="cx"> } elseif ( in_array( $post_type, $hierarchical_post_types ) ) {
</span><span class="cx"> if ( 'nav_menu_item' == $post_type )
</span><span class="cx"> return $slug;
</span><del>- // Page slugs must be unique within their own trees. Pages are in a separate
- // namespace than posts so page slugs are allowed to overlap post slugs.
</del><ins>+
+ /*
+ * Page slugs must be unique within their own trees. Pages are in a separate
+ * namespace than posts so page slugs are allowed to overlap post slugs.
+ */
</ins><span class="cx"> $check_sql = "SELECT post_name FROM $wpdb->posts WHERE post_name = %s AND post_type IN ( '" . implode( "', '", esc_sql( $hierarchical_post_types ) ) . "' ) AND ID != %d AND post_parent = %d LIMIT 1";
</span><span class="cx"> $post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $slug, $post_ID, $post_parent ) );
</span><span class="cx">
</span><ins>+ /**
+ * Filter whether the post slug would make a bad hierarchical post slug.
+ *
+ * @since 3.1.0
+ *
+ * @param bool $bad_slug Whether the post slug would be bad in a hierarchical post context.
+ * @param string $slug The post slug.
+ * @param string $post_type Post type.
+ * @param int $post_parent Post parent ID.
+ */
</ins><span class="cx"> if ( $post_name_check || in_array( $slug, $feeds ) || preg_match( "@^($wp_rewrite->pagination_base)?\d+$@", $slug ) || apply_filters( 'wp_unique_post_slug_is_bad_hierarchical_slug', false, $slug, $post_type, $post_parent ) ) {
</span><span class="cx"> $suffix = 2;
</span><span class="cx"> do {
</span><span class="lines">@@ -3281,6 +3471,15 @@
</span><span class="cx"> $check_sql = "SELECT post_name FROM $wpdb->posts WHERE post_name = %s AND post_type = %s AND ID != %d LIMIT 1";
</span><span class="cx"> $post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $slug, $post_type, $post_ID ) );
</span><span class="cx">
</span><ins>+ /**
+ * Filter whether the post slug would be bad as a flat slug.
+ *
+ * @since 3.1.0
+ *
+ * @param bool $bad_slug Whether the post slug would be bad as a flat slug.
+ * @param string $slug The post slug.
+ * @param string $post_type Post type.
+ */
</ins><span class="cx"> if ( $post_name_check || in_array( $slug, $feeds ) || apply_filters( 'wp_unique_post_slug_is_bad_flat_slug', false, $slug, $post_type ) ) {
</span><span class="cx"> $suffix = 2;
</span><span class="cx"> do {
</span><span class="lines">@@ -3292,6 +3491,18 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ /**
+ * Filter the unique post slug.
+ *
+ * @since 3.3.0
+ *
+ * @param string $slug The post slug.
+ * @param int $post_ID Post ID.
+ * @param string $post_status The post status.
+ * @param string $post_type Post type.
+ * @param int $post_parent Post parent ID
+ * @param string $original_slug The original post slug.
+ */
</ins><span class="cx"> return apply_filters( 'wp_unique_post_slug', $slug, $post_ID, $post_status, $post_type, $post_parent, $original_slug );
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -3433,21 +3644,49 @@
</span><span class="cx"> * parameter and POSTTYPE is post_type post data.
</span><span class="cx"> *
</span><span class="cx"> * @since 2.3.0
</span><ins>+ *
</ins><span class="cx"> * @link http://codex.wordpress.org/Post_Status_Transitions
</span><span class="cx"> *
</span><del>- * @uses do_action() Calls 'transition_post_status' on $new_status, $old_status and
- * $post if there is a status change.
- * @uses do_action() Calls '{$old_status}_to_{$new_status}' on $post if there is a status change.
- * @uses do_action() Calls '{$new_status}_{$post->post_type}' on post ID and $post.
- *
</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><span class="cx"> function wp_transition_post_status($new_status, $old_status, $post) {
</span><del>- do_action('transition_post_status', $new_status, $old_status, $post);
- do_action("{$old_status}_to_{$new_status}", $post);
- do_action("{$new_status}_{$post->post_type}", $post->ID, $post);
</del><ins>+ /**
+ * Fires when a post is transitioned from one status to another.
+ *
+ * @since 2.3.0
+ *
+ * @param string $new_status New post status.
+ * @param string $old_status Old post status.
+ * @param WP_Post $post Post object.
+ */
+ do_action( 'transition_post_status', $new_status, $old_status, $post );
+
+ /**
+ * Fires when a post is transitioned from one status to another.
+ *
+ * The dynamic portions of the hook name, $new_status and $old status,
+ * refer to the old and new post statuses, respectively.
+ *
+ * @since 2.3.0
+ *
+ * @param WP_Post $post Post object.
+ */
+ do_action( "{$old_status}_to_{$new_status}", $post );
+
+ /**
+ * Fires when a post is transitioned from one status to another.
+ *
+ * The dynamic portions of the hook name, $new_status and $post->post_type,
+ * refer to the new post status and post type, respectively.
+ *
+ * @since 2.3.0
+ *
+ * @param int $post_id Post ID.
+ * @param WP_Post $post Post object.
+ */
+ do_action( "{$new_status}_{$post->post_type}", $post->ID, $post );
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> //
</span><span class="lines">@@ -3471,7 +3710,16 @@
</span><span class="cx"> $pung = preg_split('/\s/', $pung);
</span><span class="cx"> $pung[] = $uri;
</span><span class="cx"> $new = implode("\n", $pung);
</span><del>- $new = apply_filters('add_ping', $new);
</del><ins>+
+ /**
+ * Filter the new ping URL to add for the given post.
+ *
+ * @since 2.0.0
+ *
+ * @param string $new New ping URL to add.
+ */
+ $new = apply_filters( 'add_ping', $new );
+
</ins><span class="cx"> // expected_slashed ($new)
</span><span class="cx"> $new = wp_unslash($new);
</span><span class="cx"> return $wpdb->update( $wpdb->posts, array( 'pinged' => $new ), array( 'ID' => $post_id ) );
</span><span class="lines">@@ -3499,7 +3747,16 @@
</span><span class="cx"> $pung[] = trim( $enclosure[ 0 ] );
</span><span class="cx"> }
</span><span class="cx"> }
</span><del>- $pung = apply_filters('get_enclosed', $pung, $post_id);
</del><ins>+
+ /**
+ * Filter the list of enclosures already enclosed for the given post.
+ *
+ * @since 2.0.0
+ *
+ * @param array $pung Array of enclosures for the given post.
+ * @param int $post_id Post ID.
+ */
+ $pung = apply_filters( 'get_enclosed', $pung, $post_id );
</ins><span class="cx"> return $pung;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -3517,7 +3774,15 @@
</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="cx"> $pung = preg_split('/\s/', $pung);
</span><del>- $pung = apply_filters('get_pung', $pung);
</del><ins>+
+ /**
+ * Filter the list of already-pinged URLs for the given post.
+ *
+ * @since 2.0.0
+ *
+ * @param array $pung Array of URLs already pinged for the given post.
+ */
+ $pung = apply_filters( 'get_pung', $pung );
</ins><span class="cx"> return $pung;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -3535,7 +3800,15 @@
</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="cx"> $to_ping = preg_split('/\s/', $to_ping, -1, PREG_SPLIT_NO_EMPTY);
</span><del>- $to_ping = apply_filters('get_to_ping', $to_ping);
</del><ins>+
+ /**
+ * Filter the list of URLs yet to ping for the given post.
+ *
+ * @since 2.0.0
+ *
+ * @param array $to_ping List of URLs yet to ping.
+ */
+ $to_ping = apply_filters( 'get_to_ping', $to_ping );
</ins><span class="cx"> return $to_ping;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -3898,7 +4171,8 @@
</span><span class="cx"> if ( $cache = wp_cache_get( $cache_key, 'posts' ) ) {
</span><span class="cx"> // Convert to WP_Post instances
</span><span class="cx"> $pages = array_map( 'get_post', $cache );
</span><del>- $pages = apply_filters('get_pages', $pages, $r);
</del><ins>+ /** This filter is documented in wp-includes/post.php */
+ $pages = apply_filters( 'get_pages', $pages, $r );
</ins><span class="cx"> return $pages;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -4028,7 +4302,8 @@
</span><span class="cx"> $pages = $wpdb->get_results($query);
</span><span class="cx">
</span><span class="cx"> if ( empty($pages) ) {
</span><del>- $pages = apply_filters('get_pages', array(), $r);
</del><ins>+ /** This filter is documented in wp-includes/post.php */
+ $pages = apply_filters( 'get_pages', array(), $r );
</ins><span class="cx"> return $pages;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -4070,7 +4345,15 @@
</span><span class="cx"> // Convert to WP_Post instances
</span><span class="cx"> $pages = array_map( 'get_post', $pages );
</span><span class="cx">
</span><del>- $pages = apply_filters('get_pages', $pages, $r);
</del><ins>+ /**
+ * Filter the retrieved list of pages.
+ *
+ * @since 2.1.0
+ *
+ * @param array $pages List of pages to retrieve.
+ * @param array $r Array of get_pages() arguments.
+ */
+ $pages = apply_filters( 'get_pages', $pages, $r );
</ins><span class="cx">
</span><span class="cx"> return $pages;
</span><span class="cx"> }
</span><span class="lines">@@ -4132,8 +4415,6 @@
</span><span class="cx"> *
</span><span class="cx"> * @since 2.0.0
</span><span class="cx"> * @uses $wpdb
</span><del>- * @uses do_action() Calls 'edit_attachment' on $post_ID if this is an update.
- * @uses do_action() Calls 'add_attachment' on $post_ID if this is not an update.
</del><span class="cx"> *
</span><span class="cx"> * @param string|array $object Arguments to override defaults.
</span><span class="cx"> * @param string $file Optional filename.
</span><span class="lines">@@ -4296,9 +4577,24 @@
</span><span class="cx"> add_post_meta( $post_ID, '_wp_attachment_context', $context, true );
</span><span class="cx">
</span><span class="cx"> if ( $update) {
</span><del>- do_action('edit_attachment', $post_ID);
</del><ins>+ /**
+ * Fires once an existing attachment has been updated.
+ *
+ * @since 2.0.0
+ *
+ * @param int $post_ID Attachment ID.
+ */
+ do_action( 'edit_attachment', $post_ID );
</ins><span class="cx"> } else {
</span><del>- do_action('add_attachment', $post_ID);
</del><ins>+
+ /**
+ * Fires once an attachment has been added.
+ *
+ * @since 2.0.0
+ *
+ * @param int $post_ID Attachment ID.
+ */
+ do_action( 'add_attachment', $post_ID );
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> return $post_ID;
</span><span class="lines">@@ -4316,7 +4612,6 @@
</span><span class="cx"> *
</span><span class="cx"> * @since 2.0.0
</span><span class="cx"> * @uses $wpdb
</span><del>- * @uses do_action() Calls 'delete_attachment' hook on Attachment ID.
</del><span class="cx"> *
</span><span class="cx"> * @param int $post_id Attachment ID.
</span><span class="cx"> * @param bool $force_delete Whether to bypass trash and force deletion. Defaults to false.
</span><span class="lines">@@ -4350,7 +4645,14 @@
</span><span class="cx"> if ( is_multisite() )
</span><span class="cx"> delete_transient( 'dirsize_cache' );
</span><span class="cx">
</span><del>- do_action('delete_attachment', $post_id);
</del><ins>+ /**
+ * Fires before an attachment is deleted, at the start of wp_delete_attachment().
+ *
+ * @since 2.0.0
+ *
+ * @param int $post_id Attachment ID.
+ */
+ do_action( 'delete_attachment', $post_id );
</ins><span class="cx">
</span><span class="cx"> wp_delete_object_term_relationships($post_id, array('category', 'post_tag'));
</span><span class="cx"> wp_delete_object_term_relationships($post_id, get_object_taxonomies($post->post_type));
</span><span class="lines">@@ -4365,11 +4667,13 @@
</span><span class="cx"> foreach ( $post_meta_ids as $mid )
</span><span class="cx"> delete_metadata_by_mid( 'post', $mid );
</span><span class="cx">
</span><ins>+ /** This action is documented in wp-includes/post.php */
</ins><span class="cx"> do_action( 'delete_post', $post_id );
</span><span class="cx"> $result = $wpdb->delete( $wpdb->posts, array( 'ID' => $post_id ) );
</span><span class="cx"> if ( ! $result ) {
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><ins>+ /** This action is documented in wp-includes/post.php */
</ins><span class="cx"> do_action( 'deleted_post', $post_id );
</span><span class="cx">
</span><span class="cx"> $uploadpath = wp_upload_dir();
</span><span class="lines">@@ -4379,7 +4683,7 @@
</span><span class="cx"> if (! $wpdb->get_row( $wpdb->prepare( "SELECT meta_id FROM $wpdb->postmeta WHERE meta_key = '_wp_attachment_metadata' AND meta_value LIKE %s AND post_id <> %d", '%' . $meta['thumb'] . '%', $post_id)) ) {
</span><span class="cx"> $thumbfile = str_replace(basename($file), $meta['thumb'], $file);
</span><span class="cx"> /** This filter is documented in wp-admin/custom-header.php */
</span><del>- $thumbfile = apply_filters('wp_delete_file', $thumbfile);
</del><ins>+ $thumbfile = apply_filters( 'wp_delete_file', $thumbfile );
</ins><span class="cx"> @ unlink( path_join($uploadpath['basedir'], $thumbfile) );
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -4395,13 +4699,13 @@
</span><span class="cx"> foreach ( $backup_sizes as $size ) {
</span><span class="cx"> $del_file = path_join( dirname($meta['file']), $size['file'] );
</span><span class="cx"> /** This filter is documented in wp-admin/custom-header.php */
</span><del>- $del_file = apply_filters('wp_delete_file', $del_file);
</del><ins>+ $del_file = apply_filters( 'wp_delete_file', $del_file );
</ins><span class="cx"> @ unlink( path_join($uploadpath['basedir'], $del_file) );
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /** This filter is documented in wp-admin/custom-header.php */
</span><del>- $file = apply_filters('wp_delete_file', $file);
</del><ins>+ $file = apply_filters( 'wp_delete_file', $file );
</ins><span class="cx">
</span><span class="cx"> if ( ! empty($file) )
</span><span class="cx"> @ unlink($file);
</span><span class="lines">@@ -4430,6 +4734,15 @@
</span><span class="cx"> if ( $unfiltered )
</span><span class="cx"> return $data;
</span><span class="cx">
</span><ins>+ /**
+ * Filter the attachment meta data.
+ *
+ * @since 2.1.0
+ *
+ * @param array|bool $data Array of meta data for the given attachment, or false
+ * if the object does not exist.
+ * @param int $post_id Attachment ID.
+ */
</ins><span class="cx"> return apply_filters( 'wp_get_attachment_metadata', $data, $post->ID );
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -4447,6 +4760,14 @@
</span><span class="cx"> if ( !$post = get_post( $post_id ) )
</span><span class="cx"> return false;
</span><span class="cx">
</span><ins>+ /**
+ * Filter the updated attachment meta data.
+ *
+ * @since 2.1.0
+ *
+ * @param array $data Array of updated attachment meta data.
+ * @param int $post_id Attachment ID.
+ */
</ins><span class="cx"> if ( $data = apply_filters( 'wp_update_attachment_metadata', $data, $post->ID ) )
</span><span class="cx"> return update_post_meta( $post->ID, '_wp_attachment_metadata', $data );
</span><span class="cx"> else
</span><span class="lines">@@ -4484,6 +4805,14 @@
</span><span class="cx"> if ( empty($url) ) //If any of the above options failed, Fallback on the GUID as used pre-2.7, not recommended to rely upon this.
</span><span class="cx"> $url = get_the_guid( $post->ID );
</span><span class="cx">
</span><ins>+ /**
+ * Filter the attachment URL.
+ *
+ * @since 2.1.0
+ *
+ * @param string $url URL for the given attachment.
+ * @param int $post_id Attachment ID.
+ */
</ins><span class="cx"> $url = apply_filters( 'wp_get_attachment_url', $url, $post->ID );
</span><span class="cx">
</span><span class="cx"> if ( empty( $url ) )
</span><span class="lines">@@ -4509,8 +4838,17 @@
</span><span class="cx">
</span><span class="cx"> $file = get_attached_file( $post->ID );
</span><span class="cx">
</span><del>- if ( !empty($imagedata['thumb']) && ($thumbfile = str_replace(basename($file), $imagedata['thumb'], $file)) && file_exists($thumbfile) )
</del><ins>+ if ( !empty($imagedata['thumb']) && ($thumbfile = str_replace(basename($file), $imagedata['thumb'], $file)) && file_exists($thumbfile) ) {
+ /**
+ * Filter the attachment thumbnail file path.
+ *
+ * @since 2.1.0
+ *
+ * @param string $thumbfile File path to the attachment thumbnail.
+ * @param int $post_id Attachment ID.
+ */
</ins><span class="cx"> return apply_filters( 'wp_get_attachment_thumb_file', $thumbfile, $post->ID );
</span><ins>+ }
</ins><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -4538,6 +4876,14 @@
</span><span class="cx">
</span><span class="cx"> $url = str_replace(basename($url), basename($thumb), $url);
</span><span class="cx">
</span><ins>+ /**
+ * Filter the attachment thumbnail URL.
+ *
+ * @since 2.1.0
+ *
+ * @param string $url URL for the attachment thumbnail.
+ * @param int $post_id Attachment ID.
+ */
</ins><span class="cx"> return apply_filters( 'wp_get_attachment_thumb_url', $url, $post->ID );
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -4602,9 +4948,32 @@
</span><span class="cx"> $icon_files = wp_cache_get('icon_files');
</span><span class="cx">
</span><span class="cx"> if ( !is_array($icon_files) ) {
</span><ins>+ /**
+ * Filter the icon directory path.
+ *
+ * @since 2.0.0
+ *
+ * @param string $path Icon directory absolute path.
+ */
</ins><span class="cx"> $icon_dir = apply_filters( 'icon_dir', ABSPATH . WPINC . '/images/media' );
</span><del>- $icon_dir_uri = apply_filters( 'icon_dir_uri', includes_url('images/media') );
- $dirs = apply_filters( 'icon_dirs', array($icon_dir => $icon_dir_uri) );
</del><ins>+
+ /**
+ * Filter the icon directory URI.
+ *
+ * @since 2.0.0
+ *
+ * @param string $uri Icon directory URI.
+ */
+ $icon_dir_uri = apply_filters( 'icon_dir_uri', includes_url( 'images/media' ) );
+
+ /**
+ * Filter the list of icon directory URIs.
+ *
+ * @since 2.5.0
+ *
+ * @param array $uris List of icon directory URIs.
+ */
+ $dirs = apply_filters( 'icon_dirs', array( $icon_dir => $icon_dir_uri ) );
</ins><span class="cx"> $icon_files = array();
</span><span class="cx"> while ( $dirs ) {
</span><span class="cx"> $keys = array_keys( $dirs );
</span><span class="lines">@@ -4651,7 +5020,17 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>- return apply_filters( 'wp_mime_type_icon', $icon, $mime, $post_id ); // Last arg is 0 if function pass mime type.
</del><ins>+ /**
+ * Filter the mime type icon.
+ *
+ * @since 2.1.0
+ *
+ * @param string $icon Path to the mime type icon.
+ * @param string $mime Mime type.
+ * @param int $post_id Attachment ID. Will equal 0 if the function passed
+ * the mime type.
+ */
+ return apply_filters( 'wp_mime_type_icon', $icon, $mime, $post_id );
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><span class="lines">@@ -4731,9 +5110,18 @@
</span><span class="cx"> if ( ! $post_type_obj )
</span><span class="cx"> return $full ? 'WHERE 1 = 0' : ' 1 = 0 ';
</span><span class="cx">
</span><del>- // This hook is deprecated. Why you'd want to use it, I dunno.
- if ( ! $cap = apply_filters( 'pub_priv_sql_capability', '' ) )
</del><ins>+ /**
+ * Filter the capability to read private posts for a custom post type
+ * when generating SQL for getting posts by author.
+ *
+ * @since 2.2.0
+ * @deprecated 3.2.0 The hook transitioned from "somewhat useless" to "totally useless".
+ *
+ * @param string $cap Capability.
+ */
+ if ( ! $cap = apply_filters( 'pub_priv_sql_capability', '' ) ) {
</ins><span class="cx"> $cap = $post_type_obj->cap->read_private_posts;
</span><ins>+ }
</ins><span class="cx">
</span><span class="cx"> if ( $full ) {
</span><span class="cx"> if ( null === $post_author ) {
</span><span class="lines">@@ -4777,12 +5165,19 @@
</span><span class="cx"> *
</span><span class="cx"> * @since 0.71
</span><span class="cx"> *
</span><del>- * @uses apply_filters() Calls 'get_lastpostdate' filter
- *
</del><span class="cx"> * @param string $timezone The location to get the time. Can be 'gmt', 'blog', or 'server'.
</span><span class="cx"> * @return string The date of the last post.
</span><span class="cx"> */
</span><span class="cx"> function get_lastpostdate($timezone = 'server') {
</span><ins>+ /**
+ * Filter the date the last post was published.
+ *
+ * @since 2.3.0
+ *
+ * @param string $date Date the last post was published. Likely values are 'gmt',
+ * 'blog', or 'server'.
+ * @param string $timezone Location to use for getting the post published date.
+ */
</ins><span class="cx"> return apply_filters( 'get_lastpostdate', _get_last_post_time( $timezone, 'date' ), $timezone );
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -4794,7 +5189,6 @@
</span><span class="cx"> * 'gmt' is when the last post was modified in GMT time.
</span><span class="cx"> *
</span><span class="cx"> * @since 1.2.0
</span><del>- * @uses apply_filters() Calls 'get_lastpostmodified' filter
</del><span class="cx"> *
</span><span class="cx"> * @param string $timezone The location to get the time. Can be 'gmt', 'blog', or 'server'.
</span><span class="cx"> * @return string The date the post was last modified.
</span><span class="lines">@@ -4806,6 +5200,14 @@
</span><span class="cx"> if ( $lastpostdate > $lastpostmodified )
</span><span class="cx"> $lastpostmodified = $lastpostdate;
</span><span class="cx">
</span><ins>+ /**
+ * Filter the date the last post was modified.
+ *
+ * @since 2.3.0
+ *
+ * @param string $lastpostmodified Date the last post was modified.
+ * @param string $timezone Location to use for getting the post modified date.
+ */
</ins><span class="cx"> return apply_filters( 'get_lastpostmodified', $lastpostmodified, $timezone );
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -4883,8 +5285,6 @@
</span><span class="cx"> *
</span><span class="cx"> * @since 2.0.0
</span><span class="cx"> *
</span><del>- * @uses do_action() Calls 'clean_post_cache' on $id before adding children (if any).
- *
</del><span class="cx"> * @param int|WP_Post $post Post ID or post object to remove from the cache.
</span><span class="cx"> */
</span><span class="cx"> function clean_post_cache( $post ) {
</span><span class="lines">@@ -4904,6 +5304,14 @@
</span><span class="cx">
</span><span class="cx"> wp_cache_delete( 'wp_get_archives', 'general' );
</span><span class="cx">
</span><ins>+ /**
+ * Fires immediately after the given post's cache is cleaned.
+ *
+ * @since 2.5.0
+ *
+ * @param int $post_id Post ID.
+ * @param WP_Post $post Post object.
+ */
</ins><span class="cx"> do_action( 'clean_post_cache', $post->ID, $post );
</span><span class="cx">
</span><span class="cx"> if ( is_post_type_hierarchical( $post->post_type ) )
</span><span class="lines">@@ -4911,6 +5319,14 @@
</span><span class="cx">
</span><span class="cx"> if ( 'page' == $post->post_type ) {
</span><span class="cx"> wp_cache_delete( 'all_page_ids', 'posts' );
</span><ins>+
+ /**
+ * Fires immediately after the given page's cache is cleaned.
+ *
+ * @since 2.5.0
+ *
+ * @param int $post_id Post ID.
+ */
</ins><span class="cx"> do_action( 'clean_page_cache', $post->ID );
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -4992,8 +5408,6 @@
</span><span class="cx"> *
</span><span class="cx"> * @since 3.0.0
</span><span class="cx"> *
</span><del>- * @uses do_action() Calls 'clean_attachment_cache' on $id.
- *
</del><span class="cx"> * @param int $id The attachment ID in the cache to clean
</span><span class="cx"> * @param bool $clean_terms optional. Whether to clean terms cache
</span><span class="cx"> */
</span><span class="lines">@@ -5011,7 +5425,14 @@
</span><span class="cx"> if ( $clean_terms )
</span><span class="cx"> clean_object_term_cache($id, 'attachment');
</span><span class="cx">
</span><del>- do_action('clean_attachment_cache', $id);
</del><ins>+ /**
+ * Fires after the given attachment's cache is cleaned.
+ *
+ * @since 3.0.0
+ *
+ * @param int $id Attachment ID.
+ */
+ do_action( 'clean_attachment_cache', $id );
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> //
</span><span class="lines">@@ -5024,7 +5445,6 @@
</span><span class="cx"> * @since 2.3.0
</span><span class="cx"> * @access private
</span><span class="cx"> * @uses $wpdb
</span><del>- * @uses do_action() Calls 'private_to_published' on post ID if this is a 'private_to_published' call.
</del><span class="cx"> * @uses wp_clear_scheduled_hook() with 'publish_future_post' and post ID.
</span><span class="cx"> *
</span><span class="cx"> * @param string $new_status New post status
</span><span class="lines">@@ -5038,7 +5458,16 @@
</span><span class="cx"> // Reset GUID if transitioning to publish and it is empty
</span><span class="cx"> if ( '' == get_the_guid($post->ID) )
</span><span class="cx"> $wpdb->update( $wpdb->posts, array( 'guid' => get_permalink( $post->ID ) ), array( 'ID' => $post->ID ) );
</span><del>- do_action('private_to_published', $post->ID); // Deprecated, use private_to_publish
</del><ins>+
+ /**
+ * Fires when a post's status is transitioned from private to published.
+ *
+ * @since 1.5.0
+ * @deprecated 2.3.0 Use 'private_to_publish' instead.
+ *
+ * @param int $post_id Post ID.
+ */
+ do_action('private_to_published', $post->ID);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // If published posts changed clear the lastpostmodified cache
</span><span class="lines">@@ -5082,13 +5511,20 @@
</span><span class="cx"> * @since 2.3.0
</span><span class="cx"> * @access private
</span><span class="cx"> * @uses XMLRPC_REQUEST and WP_IMPORTING constants.
</span><del>- * @uses do_action() Calls 'xmlrpc_publish_post' on post ID if XMLRPC_REQUEST is defined.
</del><span class="cx"> *
</span><span class="cx"> * @param int $post_id The ID in the database table of the post being published
</span><span class="cx"> */
</span><span class="cx"> function _publish_post_hook($post_id) {
</span><del>- if ( defined('XMLRPC_REQUEST') )
- do_action('xmlrpc_publish_post', $post_id);
</del><ins>+ if ( defined( 'XMLRPC_REQUEST' ) ) {
+ /**
+ * Fires when _publish_post_hook() is called during an XML-RPC request.
+ *
+ * @since 2.1.0
+ *
+ * @param int $post_id Post ID.
+ */
+ do_action( 'xmlrpc_publish_post', $post_id );
+ }
</ins><span class="cx">
</span><span class="cx"> if ( defined('WP_IMPORTING') )
</span><span class="cx"> return;
</span></span></pre>
</div>
</div>
</body>
</html>