get_blog_permalink()获取博客的链接

目录

描述

Get the permalink for a blog post from any site on the network. This function is the same as get_permalink(), except that you can get the permalink for a post from any blog on the network, not just the current blog.

get_blog_permalink() 描述

用法

 <?php echo get_blog_permalink$blog_id$post_id ); ?> 

get_blog_permalink() 用法

参数

$blog_id

(integer) (必填) ID of the blog.

默认值: None

$post_id

(integer) (必填) ID of the post you are looking for.

默认值: None

get_blog_permalink() 参数

注意

get_blog_permalink() 注意

历史

get_blog_permalink() 历史

源文件

get_blog_permalink() 函数的代码位于 wp-includes/ms-functions.php.

/* ----------------------------------
 * wordpress之魂 © http://wphun.com
 * ---------------------------------- */
/**
 * Get the permalink for a post on another blog.
 *
 * @since MU 1.0
 *
 * @param int $blog_id ID of the source blog.
 * @param int $post_id ID of the desired post.
 * @return string The post's permalink
 */
function get_blog_permalink( $blog_id, $post_id ) {
	switch_to_blog( $blog_id );
	$link = get_permalink( $post_id );
	restore_current_blog();

	return $link;
}

get_blog_permalink() 源文件

相关