How to assign the default file at “Appearance > Editor”?

Unfortunately you can’t control what files are loaded on that page…

But you can disable the editor page and provide the user with theme options that allow him to include his own CSS.

To deal with this I’m creating and activating a child theme automatically if possible:


    // fail, proably no write-access, use the parent theme...

    $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"
            ."/* You can safely edit this file, but keep the Template tag above unchanged! */\n";

      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);
        die(); // stop execution of the current page
        // fail again...