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.
Parameters
$blog_id
intrequired- ID of the blog.
$post_id
intrequired- ID of the post being looked for.
Source
function get_blog_post( $blog_id, $post_id ) {
switch_to_blog( $blog_id );
$post = get_post( $post_id );
restore_current_blog();
return $post;
}
Changelog
Version | Description |
---|---|
MU (3.0.0) | Introduced. |
Example
Get the post with id 6 from site 3: