get_blog_post( int $blog_id, int $post_id ): WP_Post|null

Gets a blog post from any site on the network.


Description

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.


Top ↑

Parameters

$blog_id int Required
ID of the blog.
$post_id int Required
ID of the post being looked for.

Top ↑

Return

WP_Post|null WP_Post object on success, null on failure


Top ↑

Source

File: wp-includes/ms-functions.php. View all references

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

	return $post;
}


Top ↑

Changelog

Changelog
Version Description
MU (3.0.0) Introduced.

Top ↑

User Contributed Notes

You must log in before being able to contribute a note or feedback.