I have a WordPress Multi Site installation and several blogs. On the frontpage (domain.com) I have a login form and when the user is logged in, it shows two links at the moment (Admin Panel and Log out). But I also want to include a link that goes to the current blog site of the user, eg: blog.domain.com.
<li class="showblog"><a href="<?php <some code> ?>">Show blog</a></li>
try use this function,,
The “
current blog
” in WPMU terms means the blog that is actually shown in the moment. In other words the current blog context of the page that is viewed in that moment or the content ofglobal $blog_id
. As in a normal wp install you would use site_url() to retreive the link of that blog. (Just pointing this out so you don’t get confused by that wording later.)I think what you are searching for is the url to the blog which belongs to that user. There is no direct function for this. The best way to get this information is to use get_blogs_of_user() to get a list of blogs a user is attached to. If your setup is configured in a way that it’s only possible for a user to have one blog, you can just use the first element from that array.
Simple example: