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.
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It only takes a minute to sign up.
Sign up to join this communityYou 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.
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:
<?php
/* Plugin Name: Local Theme Roots */
if ( 'single.wp' === $_SERVER['HTTP_HOST'] )
return;
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.