wp_prepare_revision_for_js

Filters the array of revisions used on the revisions screen.

Description

apply_filters( 'wp_prepare_revision_for_js', (array) $revisions_data, (WP_Post) $revision, (WP_Post) $post ); 

Parameters (3)

0. $revisions_data (array)
1. $revision (WP_Post)
The revision's WP_Post object.
2. $post (WP_Post)
The revision's parent WP_Post object.

Usage

To run the hook, copy the example below.
  1. $revisions_data = apply_filters( 'wp_prepare_revision_for_js', $revisions_data, $revision, $post ); 
  2.  
  3. if ( !empty( $revisions_data ) ) { 
  4.  
  5. // everything has led up to this point... 
  6.  
  7.  
The following example is for adding a hook callback.
  1. // define the wp_prepare_revision_for_js callback 
  2. function filter_wp_prepare_revision_for_js( $revisions_data, $revision, $post ) { 
  3. // make filter magic happen here... 
  4. return $revisions_data
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( 'wp_prepare_revision_for_js', 'filter_wp_prepare_revision_for_js', 10, 3 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( 'wp_prepare_revision_for_js', 'filter_wp_prepare_revision_for_js', 10, 3 ); 

Defined (1)

The filter is defined in the following location(s).

/wp-admin/includes/revision.php  
  1. $revisions[ $revision->ID ] = apply_filters( 'wp_prepare_revision_for_js', $revisions_data, $revision, $post );