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

When I navigate to...

Appearance > Editor > Edit Themes

The default file that gets loaded there is my options.css file (which I don't want anyone editing since it styles my theme options panel, not the theme itself.)

How can I specify which file gets loaded there? Ideally, I'd like for my theme's current stylesheet to be loaded there. Is there a way that I can specify this in script from functions.php?

share|improve this question
up vote 0 down vote accepted

Looking at theme-editor.php code it calls get_themes() (fills global $wp_themes variable with themes, including full lists of theme files) and then simply picks first file out of files from current theme.

It jumps to CSS because PHP and CSS files are stored separately and when arrays merge CSS comes on top.

So you can just rename your file so it isn't first in list.

More complex way would be to hook and run get_themes() earlier and then manually rearrange files in $wp_themes. I am not good with admin area, have trouble finding fitting hook to run it conditionally on editor page alone.

share|improve this answer
OK, that makes sense. Wish I had more control, but I think I'll just create a dummy css and name it 1.css or abc.css perhaps... – Scott B Sep 28 '10 at 20:27
perhaps this has been changed in the lates builds (WP 3.0+)? Although my file "custom.css" is before "style.css" by alpha, style.css still gets loaded by default when user clicks on "Appearance > Editor" – Scott B May 9 '11 at 19:12
@Scott B yes, this was changed in 3.1 branch, now it will actively try to load style.css and only goes to first file alphabetically if that isn't available. Source. – Rarst May 9 '11 at 19:24

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.