get_blog_permalink() WordPress Function

The get_blog_permalink() function is used to retrieve the permalink for a given blog post. This function can be used in conjunction with the get_permalink() function to get the permalink for a specific post.

get_blog_permalink( int $blog_id, int $post_id ) #

Gets the permalink for a post on another blog.


Parameters

$blog_id

(int)(Required)ID of the source blog.

$post_id

(int)(Required)ID of the desired post.


Top ↑

Return

(string) The post's permalink


Top ↑

Source

File: wp-includes/ms-functions.php

function get_blog_permalink( $blog_id, $post_id ) {
	switch_to_blog( $blog_id );
	$link = get_permalink( $post_id );
	restore_current_blog();

	return $link;
}


Top ↑

Changelog

Changelog
VersionDescription
MU (3.0.0) 1.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.

Show More
Show More