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

To change the upload directory I have to do this:

define ( "upload", "<new upload location>" );

How can you change the themes location? I like to create a folder themes in the root directory.

share|improve this question
up vote 1 down vote accepted

You can register additional directory or directories with themes by using register_theme_directory() function, that accepts filesystem path to folder.

Note that this isn't typical and even while core handles it mostly fine, third party code in themes and plugins might not.

share|improve this answer

You have to change the path and the URL to make sure themes work. I am using the following MU-Plugin in one of my local setups:

/* Plugin Name: Local Theme Roots */

if ( 'single.wp' === $_SERVER['HTTP_HOST'] )

add_filter( 'theme_root_uri', 't5_switch_theme_root' );
add_filter( 'theme_root',     't5_switch_theme_root' );

 * Create a custom theme directory.
 * @wp-hook theme_root
 * @wp-hook theme_root_uri
 * @author  Thomas Scholz, http://toscho.de
 * @param   string $in URL or path
 * @return  string
function t5_switch_theme_root( $in )
    // local multi-sites end with 'mu.wp'. Example: t5.mu.wp.
    if ( 0 !== stripos( strrev( $_SERVER['HTTP_HOST'] ), 'pw.um' ) )
        return $in;

    if ( 'theme_root_uri' === current_filter() )
        return "http://themes.wp";

    // If we made it so far we are in the 'theme_root' filter.
    $new_root = dirname( dirname( __DIR__ ) ) . '/wp-themes';
    register_theme_directory( $new_root );
    return $new_root;

Be aware automatic theme upgrades will not work now due to a bug in the upgrader. I have fixed that and submitted a patch, but until 3.6 comes out you have to run upgrades separately.

share|improve this answer
Doesn't seem to work toscho. maybe im missing something – Bryan Willis Sep 6 '14 at 12:40
@willow This seems to be broken as of WordPress 3.9. – toscho Sep 6 '14 at 13:22
Ok yea I thought I might have been doing something wrong. Your domain extensions with .wp threw me off at first thinking it was part of the code like "wp-". – Bryan Willis Sep 6 '14 at 16:55
It's shoking that this is really the only "almost working" solution for custom theme directories. – Bryan Willis Sep 6 '14 at 16:59

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.