wp_prepare_revision_for_js
Filter HookDescription
Filters the array of revisions used on the revisions screen. modified date matches the revision modified date (GMT-aware). }Hook Information
File Location |
wp-admin/includes/revision.php
View on GitHub
|
Hook Type | Filter |
Line Number | 282 |
Hook Parameters
Type | Name | Description |
---|---|---|
array
|
$revisions_data
|
{ The bootstrapped data for the revisions screen. |
WP_Post
|
$revision
|
The revision's WP_Post object. |
WP_Post
|
$post
|
The revision's parent WP_Post object. |
Usage Examples
Basic Usage
<?php
// Hook into wp_prepare_revision_for_js
add_filter('wp_prepare_revision_for_js', 'my_custom_filter', 10, 3);
function my_custom_filter($revisions_data, $revision, $post) {
// Your custom filtering logic here
return $revisions_data;
}
Source Code Context
wp-admin/includes/revision.php:282
- How this hook is used in WordPress core
<?php
277 * @type bool|false $restoreUrl URL if the revision can be restored, false otherwise.
278 * }
279 * @param WP_Post $revision The revision's WP_Post object.
280 * @param WP_Post $post The revision's parent WP_Post object.
281 */
282 $revisions[ $revision->ID ] = apply_filters( 'wp_prepare_revision_for_js', $revisions_data, $revision, $post );
283 }
284
285 /*
286 * If we only have one revision, the initial revision is missing. This happens
287 * when we have an autosave and the user has clicked 'View the Autosave'.
PHP Documentation
<?php
/**
* Filters the array of revisions used on the revisions screen.
*
* @since 4.4.0
*
* @param array $revisions_data {
* The bootstrapped data for the revisions screen.
*
* @type int $id Revision ID.
* @type string $title Title for the revision's parent WP_Post object.
* @type int $author Revision post author ID.
* @type string $date Date the revision was modified.
* @type string $dateShort Short-form version of the date the revision was modified.
* @type string $timeAgo GMT-aware amount of time ago the revision was modified.
* @type bool $autosave Whether the revision is an autosave.
* @type bool $current Whether the revision is both not an autosave and the post
* modified date matches the revision modified date (GMT-aware).
* @type bool|false $restoreUrl URL if the revision can be restored, false otherwise.
* }
* @param WP_Post $revision The revision's WP_Post object.
* @param WP_Post $post The revision's parent WP_Post object.
*/
Quick Info
- Hook Type: Filter
- Parameters: 3
- File: wp-admin/includes/revision.php
Related Hooks
Related hooks will be displayed here in future updates.