很遗憾,您无法控制该页面上加载的文件。。。
但您可以禁用编辑器页面,并为用户提供主题选项,允许用户包含自己的CSS。
为了解决这个问题,如果可能的话,我会自动创建并激活一个子主题:
if(!is_child_theme()){
require_once(ABSPATH.\'wp-admin/includes/file.php\');
if(!WP_Filesystem()){
// fail, proably no write-access, use the parent theme...
}else{
$parent = get_theme_data(TEMPLATEPATH.\'/style.css\');
$name = get_stylesheet().\'-extend\';
$destination = trailingslashit($GLOBALS[\'wp_filesystem\']->wp_themes_dir()).$name;
$style = "/*\\n"
."Theme Name: {$parent[\'Name\']} - Extend\\n"
."Theme URI: {$parent[\'URI\']}\\n"
."Description: Automatically generated child theme of {$parent[\'Name\']}. Please leave this one activated for proper customizations to {$parent[\'Name\']}.\\n"
."Version: 1.0\\n"
."Author: {$parent[\'Author\']}\\n"
."Author URI: {$parent[\'AuthorURI\']}\\n"
."Template: ".get_template()."\\n"
."*/\\n\\n"
."/* You can safely edit this file, but keep the Template tag above unchanged! */\\n";
if(!$GLOBALS[\'wp_filesystem\']->is_dir($destination))
if($GLOBALS[\'wp_filesystem\']->mkdir($destination, FS_CHMOD_DIR) && $GLOBALS[\'wp_filesystem\']->put_contents($destination.\'/style.css\', $style, FS_CHMOD_FILE)){
// copy screenshot and license.txt
$GLOBALS[\'wp_filesystem\']->copy(TEMPLATEPATH.\'/screenshot.png\', $destination.\'/screenshot.png\');
$GLOBALS[\'wp_filesystem\']->copy(TEMPLATEPATH.\'/license.txt\', $destination.\'/license.txt\');
switch_theme(get_template(), $name);
wp_redirect(admin_url("themes.php"));
die(); // stop execution of the current page
}else{
// fail again...
}
}
}