<!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>[27667] trunk/src/wp-admin/includes: Inline documentation for hooks in wp-admin/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/27667">27667</a></dd>
<dt>Author</dt> <dd>DrewAPicture</dd>
<dt>Date</dt> <dd>2014-03-24 01:48:40 +0000 (Mon, 24 Mar 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Inline documentation for hooks in wp-admin/includes/post.php.

Also moves the primary PHPDoc for the `edit_posts_per_page` hook to wp-admin/includes/post.php.

Props kpdesign for some cleanup.
Fixes <a href="http://core.trac.wordpress.org/ticket/27431">#27431</a>.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpadminincludesclasswppostslisttablephp">trunk/src/wp-admin/includes/class-wp-posts-list-table.php</a></li>
<li><a href="#trunksrcwpadminincludespostphp">trunk/src/wp-admin/includes/post.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpadminincludesclasswppostslisttablephp"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-admin/includes/class-wp-posts-list-table.php (27666 => 27667)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-admin/includes/class-wp-posts-list-table.php        2014-03-24 01:34:46 UTC (rev 27666)
+++ trunk/src/wp-admin/includes/class-wp-posts-list-table.php   2014-03-24 01:48:40 UTC (rev 27667)
</span><span class="lines">@@ -90,14 +90,7 @@
</span><span class="cx">          $post_type = $this->screen->post_type;
</span><span class="cx">          $per_page = $this->get_items_per_page( 'edit_' . $post_type . '_per_page' );
</span><span class="cx"> 
</span><del>-               /**
-                * Filter the number of posts displayed per page on the Posts list table.
-                *
-                * @since 2.8.0
-                *
-                * @param int    $per_page  Number of posts to be displayed. Default 20.
-                * @param string $post_type The post type.
-                */
</del><ins>+                /** This filter is documented in wp-admin/includes/post.php */
</ins><span class="cx">           $per_page = apply_filters( 'edit_posts_per_page', $per_page, $post_type );
</span><span class="cx"> 
</span><span class="cx">          if ( $this->hierarchical_display )
</span></span></pre></div>
<a id="trunksrcwpadminincludespostphp"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-admin/includes/post.php (27666 => 27667)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-admin/includes/post.php     2014-03-24 01:34:46 UTC (rev 27666)
+++ trunk/src/wp-admin/includes/post.php        2014-03-24 01:48:40 UTC (rev 27667)
</span><span class="lines">@@ -274,6 +274,7 @@
</span><span class="cx">          }
</span><span class="cx"> 
</span><span class="cx">          $attachment_data = isset( $post_data['attachments'][ $post_ID ] ) ? $post_data['attachments'][ $post_ID ] : array();
</span><ins>+
</ins><span class="cx">           /** This filter is documented in wp-admin/includes/media.php */
</span><span class="cx">          $post_data = apply_filters( 'attachment_fields_to_save', $post_data, $attachment_data );
</span><span class="cx">  }
</span><span class="lines">@@ -495,8 +496,34 @@
</span><span class="cx">          $post = new WP_Post( $post );
</span><span class="cx">  }
</span><span class="cx"> 
</span><ins>+       /**
+        * Filter the default post content initially used in the "Write Post" form.
+        *
+        * @since 1.5.0
+        *
+        * @param string  $post_content Default post content.
+        * @param WP_Post $post         Post object.
+        */
</ins><span class="cx">   $post->post_content = apply_filters( 'default_content', $post_content, $post );
</span><del>-       $post->post_title   = apply_filters( 'default_title',   $post_title, $post   );
</del><ins>+
+       /**
+        * Filter the default post title initially used in the "Write Post" form.
+        *
+        * @since 1.5.0
+        *
+        * @param string  $post_title Default post title.
+        * @param WP_Post $post       Post object.
+        */
+       $post->post_title = apply_filters( 'default_title', $post_title, $post );
+
+       /**
+        * Filter the default post excerpt initially used in the "Write Post" form.
+        *
+        * @since 1.5.0
+        *
+        * @param string  $post_excerpt Default post excerpt.
+        * @param WP_Post $post         Post object.
+        */
</ins><span class="cx">   $post->post_excerpt = apply_filters( 'default_excerpt', $post_excerpt, $post );
</span><span class="cx">  $post->post_name = '';
</span><span class="cx"> 
</span><span class="lines">@@ -865,7 +892,30 @@
</span><span class="cx">  if ( empty( $posts_per_page ) || $posts_per_page < 1 )
</span><span class="cx">          $posts_per_page = 20;
</span><span class="cx"> 
</span><ins>+       /**
+        * Filter the number of items per page to show for a specific 'per_page' type.
+        *
+        * The dynamic hook name, $per_page, refers to a hook name comprised of the post type,
+        * preceded by 'edit_', and succeeded by '_per_page', e.g. 'edit_$post_type_per_page'.
+        *
+        * Some examples of filter hooks generated here include: 'edit_attachment_per_page',
+        * 'edit_post_per_page', 'edit_page_per_page', etc.
+        *
+        * @since 3.0.0
+        *
+        * @param int $posts_per_page Number of posts to display per page for the given 'per_page'
+        *                            type. Default 20.
+        */
</ins><span class="cx">   $posts_per_page = apply_filters( $per_page, $posts_per_page );
</span><ins>+
+       /**
+        * Filter the number of posts displayed per page when specifically listing "posts".
+        *
+        * @since 2.8.0
+        *
+        * @param int    $per_page  Number of posts to be displayed. Default 20.
+        * @param string $post_type The post type.
+        */
</ins><span class="cx">   $posts_per_page = apply_filters( 'edit_posts_per_page', $posts_per_page, $post_type );
</span><span class="cx"> 
</span><span class="cx">  $query = compact('post_type', 'post_status', 'perm', 'order', 'orderby', 'posts_per_page');
</span><span class="lines">@@ -906,7 +956,6 @@
</span><span class="cx">  * can be passed in, which will override the arguments set by this function.
</span><span class="cx">  *
</span><span class="cx">  * @since 2.5.0
</span><del>- * @uses apply_filters() Calls 'upload_per_page' on posts_per_page argument
</del><span class="cx">  *
</span><span class="cx">  * @param array|bool $q Array of query variables to use to build the query or false to use $_GET superglobal.
</span><span class="cx">  * @return array
</span><span class="lines">@@ -927,6 +976,14 @@
</span><span class="cx">  $media_per_page = (int) get_user_option( 'upload_per_page' );
</span><span class="cx">  if ( empty( $media_per_page ) || $media_per_page < 1 )
</span><span class="cx">          $media_per_page = 20;
</span><ins>+
+       /**
+        * Filter the number of items to list per page when listing media items.
+        *
+        * @since 2.9.0
+        *
+        * @param int $media_per_page Number of media to list. Default 20.
+        */
</ins><span class="cx">   $q['posts_per_page'] = apply_filters( 'upload_per_page', $media_per_page );
</span><span class="cx"> 
</span><span class="cx">  $post_mime_types = get_post_mime_types();
</span><span class="lines">@@ -966,6 +1023,16 @@
</span><span class="cx">          $classes = array( '' );
</span><span class="cx">  }
</span><span class="cx"> 
</span><ins>+       /**
+        * Filter the postbox classes for a specific screen and screen ID combo.
+        *
+        * The dynamic portions of the hook name, $page, and $id, refer to
+        * the screen, and screen ID, respectively.
+        *
+        * @since 3.2.0
+        *
+        * @param array $classes An array of postbox classes.
+        */
</ins><span class="cx">   $classes = apply_filters( "postbox_classes_{$page}_{$id}", $classes );
</span><span class="cx">  return implode( ' ', $classes );
</span><span class="cx"> }
</span><span class="lines">@@ -1017,13 +1084,16 @@
</span><span class="cx">          $uri = untrailingslashit($uri);
</span><span class="cx">          $uri = strrev( stristr( strrev( $uri ), '/' ) );
</span><span class="cx">          $uri = untrailingslashit($uri);
</span><ins>+
+               /** This filter is documented in wp-admin/edit-tag-form.php */
</ins><span class="cx">           $uri = apply_filters( 'editable_slug', $uri );
</span><span class="cx">          if ( !empty($uri) )
</span><span class="cx">                  $uri .= '/';
</span><span class="cx">          $permalink = str_replace('%pagename%', "{$uri}%pagename%", $permalink);
</span><span class="cx">  }
</span><span class="cx"> 
</span><del>-       $permalink = array($permalink, apply_filters('editable_slug', $post->post_name));
</del><ins>+        /** This filter is documented in wp-admin/edit-tag-form.php */
+       $permalink = array( $permalink, apply_filters( 'editable_slug', $post->post_name ) );
</ins><span class="cx">   $post->post_status = $original_status;
</span><span class="cx">  $post->post_date = $original_date;
</span><span class="cx">  $post->post_name = $original_name;
</span><span class="lines">@@ -1067,7 +1137,17 @@
</span><span class="cx">          if ( isset( $view_post ) )
</span><span class="cx">                  $return .= "<span id='view-post-btn'><a href='$permalink' class='button button-small'>$view_post</a></span>\n";
</span><span class="cx"> 
</span><del>-               $return = apply_filters('get_sample_permalink_html', $return, $id, $new_title, $new_slug);
</del><ins>+                /**
+                * Filter the sample permalink HTML markup.
+                *
+                * @since 2.9.0
+                *
+                * @param string      $return    Sample permalink HTML markup.
+                * @param int|WP_Post $id        Post object or ID.
+                * @param string      $new_title New sample permalink title.
+                * @param string      $new_slug  New sample permalink slug.
+                */
+               $return = apply_filters( 'get_sample_permalink_html', $return, $id, $new_title, $new_slug );
</ins><span class="cx"> 
</span><span class="cx">          return $return;
</span><span class="cx">  }
</span><span class="lines">@@ -1099,7 +1179,8 @@
</span><span class="cx">          $return .= "<span id='view-post-btn'><a href='" . get_permalink( $post ) . "' class='button button-small'>$view_post</a></span>\n";
</span><span class="cx">  }
</span><span class="cx"> 
</span><del>-       $return = apply_filters('get_sample_permalink_html', $return, $id, $new_title, $new_slug);
</del><ins>+        /** This filter is documented in wp-admin/includes/post.php */
+       $return = apply_filters( 'get_sample_permalink_html', $return, $id, $new_title, $new_slug );
</ins><span class="cx"> 
</span><span class="cx">  return $return;
</span><span class="cx"> }
</span><span class="lines">@@ -1137,6 +1218,14 @@
</span><span class="cx">          $content_width = $old_content_width;
</span><span class="cx">  }
</span><span class="cx"> 
</span><ins>+       /**
+        * Filter the admin post thumbnail HTML markup to return.
+        *
+        * @since 2.9.0
+        *
+        * @param string $content Admin post thumbnail HTML markup.
+        * @param int    $post_id Post ID.
+        */
</ins><span class="cx">   return apply_filters( 'admin_post_thumbnail_html', $content, $post->ID );
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -1159,6 +1248,7 @@
</span><span class="cx">  $time = $lock[0];
</span><span class="cx">  $user = isset( $lock[1] ) ? $lock[1] : get_post_meta( $post->ID, '_edit_last', true );
</span><span class="cx"> 
</span><ins>+       /** This filter is documented in wp-admin/includes/ajax-actions.php */
</ins><span class="cx">   $time_window = apply_filters( 'wp_check_post_lock_window', 150 );
</span><span class="cx"> 
</span><span class="cx">  if ( $time && $time > time() - $time_window && $user != get_current_user_id() )
</span><span class="lines">@@ -1203,6 +1293,17 @@
</span><span class="cx">          $user = get_userdata( $user_id );
</span><span class="cx"> 
</span><span class="cx">  if ( $user ) {
</span><ins>+
+               /**
+                * Filter whether to show the post locked dialog.
+                *
+                * Returning a falsey value to the filter will short-circuit displaying the dialog.
+                *
+                * @since 3.6.0
+                *
+                * @param bool         $display Whether to display the dialog. Default true.
+                * @param WP_User|bool $user    WP_User object on success, false otherwise.
+                */
</ins><span class="cx">           if ( ! apply_filters( 'show_post_locked_dialog', true, $post, $user ) )
</span><span class="cx">                  return;
</span><span class="cx"> 
</span><span class="lines">@@ -1245,7 +1346,21 @@
</span><span class="cx">                  $preview_link = '';
</span><span class="cx">          }
</span><span class="cx"> 
</span><ins>+               /** This filter is documented in wp-admin/includes/meta-boxes.php */
</ins><span class="cx">           $preview_link = apply_filters( 'preview_post_link', $preview_link );
</span><ins>+
+               /**
+                * Filter whether to allow the post lock to be overridden.
+                *
+                * Returning a falsey value to the filter will disable the ability
+                * to override the post lock.
+                *
+                * @since 3.6.0
+                *
+                * @param bool    $override Whether to allow overriding post locks. Default true.
+                * @param WP_Post $post     Post object.
+                * @param WP_User $user     User object.
+                */
</ins><span class="cx">           $override = apply_filters( 'override_post_lock', true, $post, $user );
</span><span class="cx">          $tab_last = $override ? '' : ' wp-tab-last';
</span><span class="cx"> 
</span><span class="lines">@@ -1259,7 +1374,16 @@
</span><span class="cx">                          printf( ' ' . __( 'If you take over, %s will be blocked from continuing to edit.' ), esc_html( $user->display_name ) );
</span><span class="cx">          ?>
</span><span class="cx">          </p>
</span><del>-               <?php do_action( 'post_locked_dialog', $post ); ?>
</del><ins>+                <?php
+               /**
+                * Fires inside the post locked dialog before the buttons are displayed.
+                *
+                * @since 3.6.0
+                *
+                * @param WP_Post $post Post object.
+                */
+               do_action( 'post_locked_dialog', $post );
+               ?>
</ins><span class="cx">           <p>
</span><span class="cx">          <a class="button" href="<?php echo esc_url( $sendback ); ?>"><?php echo $sendback_text; ?></a>
</span><span class="cx">          <?php if ( $preview_link ) { ?>
</span><span class="lines">@@ -1287,7 +1411,16 @@
</span><span class="cx">                  <span class="locked-saving hidden"><img src="images/wpspin_light-2x.gif" width="16" height="16" /> <?php _e('Saving revision...'); ?></span>
</span><span class="cx">                  <span class="locked-saved hidden"><?php _e('Your latest changes were saved as a revision.'); ?></span>
</span><span class="cx">                  </p>
</span><del>-                       <?php do_action( 'post_lock_lost_dialog', $post ); ?>
</del><ins>+                        <?php
+                       /**
+                        * Fires inside the dialog displayed when a user has lost the post lock.
+                        *
+                        * @since 3.6.0
+                        *
+                        * @param WP_Post $post Post object.
+                        */
+                       do_action( 'post_lock_lost_dialog', $post );
+                       ?>
</ins><span class="cx">                   <p><a class="button button-primary wp-tab-last" href="<?php echo esc_url( $sendback ); ?>"><?php echo $sendback_text; ?></a></p>
</span><span class="cx">          </div>
</span><span class="cx">          <?php
</span><span class="lines">@@ -1414,6 +1547,8 @@
</span><span class="cx">  }
</span><span class="cx"> 
</span><span class="cx">  $url = add_query_arg( $query_args, get_permalink( $post->ID ) );
</span><ins>+
+       /** This filter is documented in wp-admin/includes/meta-boxes.php */
</ins><span class="cx">   return apply_filters( 'preview_post_link', $url );
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>