WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
See wordpress.stackexchange.com/questions/83102/…. This is the only way. – toscho Jun 2 '13 at 20:15
How do you define themes in config? – Rarst Jun 2 '13 at 20:46
@Rarst: isn't that the point of my question? :-) – Denis de Bernardy Jun 2 '13 at 23:27
Misread the question. :) – Rarst Jun 3 '13 at 10:09
up vote 2 down vote accepted

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?

share|improve this answer
Yeah, I was giving thoughts to setting the global, but... Yuck... :-D At any rate, thanks for confirming... – Denis de Bernardy Jun 2 '13 at 23:25

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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