get_blog_post()
get_blog_post( int $blog_id, int $post_id ) 从网络上的任何站点获取…
get_blog_post( int $blog_id, int $post_id )
从网络上的任何站点获取博客文章。
Get a blog post from any site on the network.
目录锚点:#参数#返回#源码#笔记
参数(Parameters)
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| $blog_id | (int) | 必需 | 博客的ID。 |
| $post_id | (int) | 必需 | 正在查找的邮件的ID。 |
返回(Return)
(WP|Post|null)WP_Post on success或null on failure
源码(Source)
/**
* Get a blog post from any site on the network.
*
* @since MU 1.0
*
* @param int $blog_id ID of the blog.
* @param int $post_id ID of the post you're looking for.
* @return WP_Post|null WP_Post on success or null on failure
*/
function get_blog_post( $blog_id, $post_id ) {
switch_to_blog( $blog_id );
$post = get_post( $post_id );
restore_current_blog();
return $post;
}| 更新版本 | 源码位置 | 使用 | 被使用 |
|---|---|---|---|
| MU (3.0.0) | wp-includes/ms-functions.php:143 | 0 | 3 |
笔记(Notes)
例子
类别:WordPress 函数手册、
本文收集自互联网,转载请注明来源。
如有侵权,请联系 wper_net@163.com 删除。
还没有任何评论,赶紧来占个楼吧!