Title: get_blog_permalink
Published: April 25, 2014
Last modified: April 28, 2025

---

# get_blog_permalink( int $blog_id, int $post_id ): string

## In this article

 * [Parameters](https://developer.wordpress.org/reference/functions/get_blog_permalink/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/functions/get_blog_permalink/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/functions/get_blog_permalink/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/functions/get_blog_permalink/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/get_blog_permalink/?output_format=md#changelog)
 * [User Contributed Notes](https://developer.wordpress.org/reference/functions/get_blog_permalink/?output_format=md#user-contributed-notes)

[ Back to top](https://developer.wordpress.org/reference/functions/get_blog_permalink/?output_format=md#wp--skip-link--target)

Gets the permalink for a post on another blog.

## 󠀁[Parameters](https://developer.wordpress.org/reference/functions/get_blog_permalink/?output_format=md#parameters)󠁿

 `$blog_id`intrequired

ID of the source blog.

`$post_id`intrequired

ID of the desired post.

## 󠀁[Return](https://developer.wordpress.org/reference/functions/get_blog_permalink/?output_format=md#return)󠁿

 string The post’s permalink.

## 󠀁[Source](https://developer.wordpress.org/reference/functions/get_blog_permalink/?output_format=md#source)󠁿

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

    	return $link;
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-functions.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-includes/ms-functions.php#L326)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/ms-functions.php#L326-L332)

## 󠀁[Related](https://developer.wordpress.org/reference/functions/get_blog_permalink/?output_format=md#related)󠁿

| Uses | Description | 
| [switch_to_blog()](https://developer.wordpress.org/reference/functions/switch_to_blog/)`wp-includes/ms-blogs.php` |

Switches the current blog.

  | 
| [restore_current_blog()](https://developer.wordpress.org/reference/functions/restore_current_blog/)`wp-includes/ms-blogs.php` |

Restores the current blog, after calling [switch_to_blog()](https://developer.wordpress.org/reference/functions/switch_to_blog/) .

  | 
| [get_permalink()](https://developer.wordpress.org/reference/functions/get_permalink/)`wp-includes/link-template.php` |

Retrieves the full permalink for the current post or post ID.

  |

[Show 1 more](https://developer.wordpress.org/reference/functions/get_blog_permalink/?output_format=md#)
[Show less](https://developer.wordpress.org/reference/functions/get_blog_permalink/?output_format=md#)

## 󠀁[Changelog](https://developer.wordpress.org/reference/functions/get_blog_permalink/?output_format=md#changelog)󠁿

| Version | Description | 
| [MU (3.0.0) 1.0](https://developer.wordpress.org/reference/since/mu.3.0.0.1.0/) | Introduced. |

## 󠀁[User Contributed Notes](https://developer.wordpress.org/reference/functions/get_blog_permalink/?output_format=md#user-contributed-notes)󠁿

 1.  [Skip to note 2 content](https://developer.wordpress.org/reference/functions/get_blog_permalink/?output_format=md#comment-content-1426)
 2.   [Codex](https://profiles.wordpress.org/codex/)  [  10 years ago  ](https://developer.wordpress.org/reference/functions/get_blog_permalink/#comment-1426)
 3. [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fget_blog_permalink%2F%23comment-1426)
    Vote results for this note: 0[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fget_blog_permalink%2F%23comment-1426)
 4. **Example**
 5. From any blog in the network, get the permalink for post with ID 6 on blog ID 3.
 6.     ```php
        <?php echo get_blog_permalink( $blog = 3, $post = 6 ); ?>
        ```
    
 7.  [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fget_blog_permalink%2F%3Freplytocom%3D1426%23feedback-editor-1426)

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fget_blog_permalink%2F)
before being able to contribute a note or feedback.