How To Add The Theme Editor To WordPress MU

by Paul Wilson

 

For the last several years I have been working on a wordpress MU project that seems to be the bane of my existence. I will work on it non-stop for several days, and then leave it alone for a few months and then go back and find errors that I hadn’t noticed before. It is really frustrating but some day I will actually finish and launch this project.

One of my biggest issues though, is my desire to have the theme editor active while I am in the development phase. Obviously, it is not wise to have the theme editor available when you launch a community. Having your theme editor global allows any user the ability to change the theme for your whole community. Yet, I spend a lot of my time in the wordpress admin area and having to jump from admin to ftp is annoying (yes, I admit I am lazy, efficient, but lazy).

Anyway, WordPress MU deactivates the theme editor by default. Since I go periods of time without touching MU when I come back I have to update my wordpress instance. Every time I lose my precious theme editor, and every time I have to dig through Google to find the solution to bring it back.

So, for my sanity I am recording the process here so I can easily find it six months from now. This solution is current for wordpress mu 2.8.6. Who knows if it will work beyond 2.8.6. If so, I will write another post and link this post to it.

FTP to your server and open admin/includes/mu.php. Here you want to find the “old” code and change it to the “new” code.

old: unset( $submenu['themes.php'][10] ); // always remove the themes editor
new: //unset( $submenu['themes.php'][10] ); // always remove the themes editor

This change will let you see the theme editor option in the appearance menu. However, when you click on it the WordPress Gods will tell you the function has been disabled. In the same mu.php file you will need to find and make the below change.

old: if ( strpos( $_SERVER['PHP_SELF'], $page ) ) {
new: if ( strpos( $_SERVER['PHP_SELF'], $page ) && !is_site_admin() ) {

Hopefully, this process won’t change for a while, or at least until I launch my project. Good luck.

Related Posts: