WordPress at Your Fingertips
function is not described

_set_preview() WP 2.7.0

Sets up the post object for preview based on the post autosave.

This is an internal function for using it by WP core itself. It's not recommended to use this function in your code.

No Hooks.

Return

WP_Post|false.

Usage

_set_preview( $post );
$post(WP_Post) (required)
-

Code of _set_preview() WP 5.8.3

function _set_preview( $post ) {
	if ( ! is_object( $post ) ) {
		return $post;
	}

	$preview = wp_get_post_autosave( $post->ID );
	if ( ! is_object( $preview ) ) {
		return $post;
	}

	$preview = sanitize_post( $preview );

	$post->post_content = $preview->post_content;
	$post->post_title   = $preview->post_title;
	$post->post_excerpt = $preview->post_excerpt;

	add_filter( 'get_the_terms', '_wp_preview_terms_filter', 10, 3 );
	add_filter( 'get_post_metadata', '_wp_preview_post_thumbnail_filter', 10, 3 );

	return $post;
}