Is anyone aware of an equivalent to WP_PLUGIN_DIR and WP_PLUGIN_URL for themes that I can define in wp-config.php, or am I stuck creating a mu-plugin and registering a new theme dir?


1 Answer 1


The default theme directory is registered like this in wp-settings.php

// Register the default theme directory root
register_theme_directory( get_theme_root() );


function get_theme_root( $stylesheet_or_template = false ) {
        global $wp_theme_directories;

        if ( $stylesheet_or_template && $theme_root = get_raw_theme_root( $stylesheet_or_template ) ) {
                // Always prepend WP_CONTENT_DIR unless the root currently registered as a theme directory.
                // This gives relative theme roots the benefit of the doubt when things go haywire.
                if ( ! in_array( $theme_root, (array) $wp_theme_directories ) )
                        $theme_root = WP_CONTENT_DIR . $theme_root;
        } else {
                $theme_root = WP_CONTENT_DIR . '/themes';

        return apply_filters( 'theme_root', $theme_root );

The functions get_theme_root() and get_raw_theme_root() seems to be used in other theme related functions.

I don't see any theme related pre-defined constants used here so I would think that you are stuck with a plugin ;-)

Maybe playing around with the global $wp_theme_directories might get you somewhere?

  • Yeah, I was giving thoughts to setting the global, but... Yuck... :-D At any rate, thanks for confirming... Commented Jun 2, 2013 at 23:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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