您必须更改path 以及URL 确保主题有效。我正在使用以下MU-Plugin 在我的一个本地设置中:
<?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;
}
请注意,由于
bug in the upgrader. 我已经修复并提交了一个补丁,但在3.6版本发布之前,您必须单独运行升级。