get_blog_post()
最后更新于:2021-11-26 06:27:20
get_blog_post( int$blog_id, int$post_id)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.
响应
(GC_Post|null) GC_Post object on success, null on failure
源文件
文件: gc-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;
}