Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: wp_prepare_revision_for_js

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

Line Code
260            *     @type string     $timeAgo    GMT-aware amount of time ago the revision was modified.
261            *     @type bool       $autosave   Whether the revision is an autosave.
262            *     @type bool       $current    Whether the revision is both not an autosave and the post
263            *                                  modified date matches the revision modified date (GMT-aware).
264            *     @type bool|false $restoreUrl URL if the revision can be restored, false otherwise.
265            * }
266            * @param WP_Post $revision       The revision's WP_Post object.
267            * @param WP_Post $post           The revision's parent WP_Post object.
268            */
269           $revisions[ $revision->ID ] = apply_filters( 'wp_prepare_revision_for_js', $revisions_data, $revision, $post );
270      }
271
272      /**
273       * If we only have one revision, the initial revision is missing; This happens
274       * when we have an autsosave and the user has clicked 'View the Autosave'
275       */
276      if ( 1 === sizeof( $revisions ) ) {
277           $revisions[ $post->ID ] = array(
278                'id'         => $post->ID,