Set up global post data.

Signature

setup_postdata( $post )
post
 (WP_Post|object|int) WP_Post instance or Post ID/object.

Return

(boolean) True when finished.

Source

function setup_postdata( $post ) {
	global $wp_query;

	if ( ! empty( $wp_query ) && $wp_query instanceof WP_Query ) {
		return $wp_query->setup_postdata( $post );
	}

	return false;
}
WP Trac GitHub

Link here