On this page
get_blog_permalink( int $blog_id, int $post_id ): string
Gets the permalink for a post on another blog.
Parameters
$blog_idint Required-
ID of the source blog.
$post_idint Required-
ID of the desired post.
Return
string The post's permalink
Source
File: wp-includes/ms-functions.php. View all references
function get_blog_permalink( $blog_id, $post_id ) {
switch_to_blog( $blog_id );
$link = get_permalink( $post_id );
restore_current_blog();
return $link;
}
Related
Uses
| Uses | Description |
|---|---|
| restore_current_blog() wp-includes/ms-blogs.php | Restore the current blog, after calling switch_to_blog() . |
| switch_to_blog() wp-includes/ms-blogs.php | Switch the current blog. |
| get_permalink() wp-includes/link-template.php | Retrieves the full permalink for the current post or post ID. |
Changelog
| Version | Description |
|---|---|
| MU (3.0.0) 1.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/get_blog_permalink