[resolved] Get folder name for each multisite (7 posts)

  1. charliebrimm
    Posted 4 years ago #

    Is there a function that will give me back the directory that a multisite blog is in?

    say the url is:


    Is there something I can call that will give me back "bobsblog"?

    I am specifically looking for the directory and not the blog title.


  2. http://codex.wordpress.org/WPMU_Functions/get_current_site

    Returns an object containing the ID, domain, path, and site_name of the site being viewed.

  3. but site_name is the install name, not the blog_name.

  4. charliebrimm
    Posted 4 years ago #

    Thanks for the links. Unfortunately neither work for me. With get_blogaddress_by_domain($domain, $path); I get:


    $current_site->path returns /

    $current_site->domain returns website.com as expected

    $current_site->id returns 1 which is the main blog not the blog I am viewing.

    I am including this in header.php of the them because this is where I need the value

    I can get a full url using other wp functions but all I really want is the current blog directory.


  5. Curtiss Grymala
    Posted 4 years ago #

    I think you might want the get_blog_details() function.

    $this_blog = get_blog_details( $GLOBALS['blog_id'] );
    echo $this_blog->path;
  6. charliebrimm
    Posted 4 years ago #

    Perfect Curtiss!

    Thanks. I'd tried blog details but not like that.

Topic Closed

This topic has been closed to new replies.

About this Topic