I am using multi-site instance, but want each site to use the same themes throughout. When I reference


I was expecting:


instead I get:


Is their a WP function I can use to get the main them directory only, and not have WP include each site's directory name?

  • I suspect that you're seeing the proper behaviour. Multisite sets up those virtual paths, and then your .htaccess file will point them to the correct filesystem locations. Have you tried get_stylesheet_directory_uri(), as recommended on the Codex page for get_bloginfo()? – Pat J Jan 22 '14 at 19:29
  • I'm sure it is the working way that WP implemented it. Is there any existing workaround for that? Other than having to hack it myself? Yes, I have tried codex.wordpress.org/Function_Reference/… and it gives me the same result =/ – cj5 Jan 22 '14 at 19:34

Okay I avoided the lazy way out =)

For others that have my particular site requirements, here's my workaround, of simply creating my own custom method in functions.php:

function mysite_get_theme_directory_uri() {
    // chop up the url from get_stylesheet directory
    $parsedUrl = parse_url(get_stylesheet_directory_uri());

    // chop up the 'path' index value
    $path = $parsedUrl['path'];
    // make it an array
    $parsedPath = explode('/', $path);
    // remove the 3rd element of the path's array, which is the site name

    // put that path array back into a string
    $themesPath = implode("/", $parsedPath);

    // return full URL
    return $parsedUrl['scheme'] . '://' . $parsedUrl['host'] . $themesPath;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.