the_preview filter-hookWP 2.7.0

Filters the single post for preview mode.

Usage

add_filter( 'the_preview', 'wp_kama_the_preview_filter', 10, 2 );

/**
 * Function for `the_preview` filter-hook.
 * 
 * @param WP_Post  $post_preview The Post object.
 * @param WP_Query $query        The WP_Query instance (passed by reference).
 *
 * @return WP_Post
 */
function wp_kama_the_preview_filter( $post_preview, $query ){

	// filter...
	return $post_preview;
}
$post_preview(WP_Post)
The Post object.
$query(WP_Query)
The WP_Query instance (passed by reference).

Changelog

Since 2.7.0 Introduced.

Where the hook is called

WP_Query::get_posts()
the_preview
wp-includes/class-wp-query.php 3253
$this->posts[0] = get_post( apply_filters_ref_array( 'the_preview', array( $this->posts[0], &$this ) ) );

Where the hook is used in WordPress

wp-includes/revision.php 670
add_filter( 'the_preview', '_set_preview' );