Get permalink of a custom post type from another blog in a multisite solution

I have a site with 2 blogs: blog1 (main blog) and blog2.

I have create a plugin that create a custom post type called “video”.

So I installed this plugin in my blog2.

In blog1 I want to show some posts (video) from blog2.

So this is the procedure

switch_to_blog(2);
$permalink=get_permalink(POST_ID_FROM_BLOG_2);
restore_current_blog();

If I do get_permalink() in blog2 this is the url

http://example.com/video/post_example/

Instead if I do it on the blog1

http://example.com/post_example/

Is there any way to get the correct url without install the plugin in the main blog?

thank you

Read more here: Get permalink of a custom post type from another blog in a multisite solution

Leave a Reply

Your email address will not be published. Required fields are marked *