get_blog_post( int $blog_id, int $post_id )
Get a blog post from any site on the network.
Description Description
Parameters Parameters
- $blog_id
-
(int) (Required) ID of the blog.
- $post_id
-
(int) (Required) ID of the post you're looking for.
Return Return
Source Source
File: wp-includes/ms-functions.php
function get_blog_post( $blog_id, $post_id ) {
switch_to_blog( $blog_id );
$post = get_post( $post_id );
restore_current_blog();
return $post;
}
Expand full source code Collapse full source code View on Trac
Changelog Changelog
| Version | Description |
|---|---|
| MU (3.0.0) | Introduced. |
User Contributed Notes User Contributed Notes
You must log in before being able to contribute a note or feedback.
Example
Get the post with id 6 from site 3:
$post_6 = get_blog_post( 3, 6 ); if ( $post_6 ) { echo $post_6->post_title; }