get_blog_post()WP 3.0.0

Gets a blog post from any site on the network.

This function is similar to get_post(), except that it can retrieve a post from any site on the network, not just the current site.

No Hooks.

Return

WP_Post|null. WP_Post object on success, null on failure

Usage

get_blog_post( $blog_id, $post_id );
$blog_id(int) (required)
ID of the blog.
$post_id(int) (required)
ID of the post being looked for.

Changelog

Since 3.0.0 Introduced.

get_blog_post() code WP 6.5.2

function get_blog_post( $blog_id, $post_id ) {
	switch_to_blog( $blog_id );
	$post = get_post( $post_id );
	restore_current_blog();

	return $post;
}