函数原型
get_blog_post( int $blog_id, int $post_id ): WP_Post|null
函数描述
Gets a blog post from any site on the network.
是否弃用
未弃用
函数参数
-
$blog_id
int
Required - ID of the blog.
-
$post_id
int
Required - ID of the post being looked for.
函数返回值
WP_Post|null WP_Post object on success, null on failure
函数位置
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;
}
源码链接
变更日志
| Version | Description |
|---|---|
| MU (3.0.0) | Introduced. |

