Enable Theme and Plugin Editor on WordPress MU

If you have installed WordPress MU and like to have the theme editor and plugin editor for easy customization of themes and plugin from dashboard (like normal wordpress), then here is the customization technique to get the same. For those who are new to WordPress MU, there is no provision for tabs as “Theme Editor” under Appearance section and “Plugin Editor” under Plugins section on Dashboard in WPMU.

Theme/Plugin Editor in WordPress MU

To get the theme editor panel in WPMU, follow the below steps,

Edit MU.PHP file

To get the editor on dashboard, you will have to edit the mu.php file available under “wp-admin/includes” folder of your WordPress MU installation.

Wordpress mu.php

1. Search for the term “unset( $submenu['themes.php'][10]” in mu.php, you will find only one search result. At that place, you ned to make changes. We have provided below the before and after changes code. We need to comment two lines which are actually there to remove plugin editor and theme editor.

Before Changes


unset( $submenu['plugins.php'][15] ); // always remove the plugin editor 
unset( $submenu['themes.php'][10] );  // always remove the themes editor

After Changes


/* unset( $submenu['plugins.php'][15] ); */ // always remove the plugin 
/* unset( $submenu['themes.php'][10] ); */ // always remove the themes

2. After removing this check, you should be able to see the theme editor and plugin editor option but still those pages will not accessible. To remove that barrier, you need to make below changes in mu.php only.

Search for the term “if ( strpos( $_SERVER['PHP_SELF'], ‘user-new.php’” in mu.php and then see below the before and after code for the same line (search result)

Before Changes


$pages = array( 'theme-editor.php', 'plugin-editor.php' ); 
foreach( $pages as $page ) { 
    if ( strpos( $_SERVER['PHP_SELF'], $page ) ) { 
        wp_die( __('Page disabled by the administrator') );

After Changes


$pages = array( 'theme-editor.php', 'plugin-editor.php' ); 
  foreach( $pages as $page ) { 
     if ( strpos( $_SERVER['PHP_SELF'], $page )&& !is_site_admin() ) { 
         wp_die( __('Page disabled by the administrator') );

Now you can check in your WordPress MU dashboard; the theme editor and plugin editor should work properly in your MU installation.

Note: if you are using WordPress MU 2.7 or below that then you will have to copy theme-editor.php from normal wordpress setup (wp-admin/theme-editor.php) to the same location in WPMU. After WPMU 2.7, WordPress started giving theme-editor.php with the installation setup.

Related Post: Download WordPress 2.9 Beta 1 (Rare)

Sanjeev Mishra is a professional blogger and an Internet Marketing Consultant based in India. He has built the Internet Techies to provide you updates in technology and web application area.

13 Comments

  1. Haress

    November 21, 2009 at 7:34 am

    Hi,
    If you would like to present a special mobile theme for your mobile users check out my latest wordpress mobile + theme pack.

    Introducing you IamMobiled Mobile Plugin

    Here are some key features:
    1) Comes with a mobile theme “Blue Heart”
    2) Automatic mobile detection
    3) Images are optimized for mobile view
    4) Make $$$ through integrated ad system.
    5) Optimized for touch screen phones
    6) Mobile users can even leave comments
    7) Mobile users can search for contents.

    Please check it out and let me know your feedback and suggestions at http://iammobiled.com
    Plugin can be found at:
    http://wordpress.org/extend/plugins/iammobiled-mobile/
    Thanks,
    Haress

  2. Vitaliy Syromyatnikov

    January 18, 2010 at 3:12 pm

    I have set my mu.php as You have advised and now can see Themes and Plugins editor links and can change the source code!
    Thanx a lot, Sanjeev!

  3. Venugopal

    January 20, 2010 at 7:57 pm

    Thank you very much Sanjeev , that was very helpful . Truly appreciate your proactive lead on this subject

  4. Fujilives

    January 23, 2010 at 1:35 am

    This was a pretty straight forward and useful tutorial. Thanks. I’m not sure why this isn’t enabled for the ‘admin’ level (not blog-user , but primary admin) by default. I’m also not sure why there isn’t a MU-plug-in that enables this, oh well, at least their plug-in-management has come along further ;). Soon MU might replace the regular WP installation, since segmenting off searches and contextual stuff is such a pain in the rear in a normal WP install right now, I’m thinking MU and creating ‘users’ for each ‘portion’ of a website (media / news / faq etc) might be the way things go. It beats trying to use contextual widget management and ‘picking’ pages you want stuff to, or not to, show up on.

  5. bflyadmin

    January 31, 2010 at 6:04 am

    Where is the theme editor link or menu option supposed to appear after making these changes?

  6. bflyadmin

    January 31, 2010 at 6:05 am

    I’ve checked and rechecked the changes…

  7. Ajay

    February 20, 2010 at 6:34 pm

    Kool post. I didn’t realize that this can be done so easily. I’ve been changing themes manually and uploading via ftp.

    Tx for sharing the tips.

  8. Richard

    March 9, 2010 at 6:52 pm

    Hi
    I tried this editing to enable the themes editor in WPMU but have been unsuccessful
    and now have this error message showing on my site admin page:

    Warning: Cannot modify header information – headers already sent by (output started at C:\xampp\htdocs\wpmu\wp-admin\includes\mu.php:1) in C:\xampp\htdocs\wpmu\wp-includes\functions.php on line 808

    Warning: Cannot modify header information – headers already sent by (output started at C:\xampp\htdocs\wpmu\wp-admin\includes\mu.php:1) in C:\xampp\htdocs\wpmu\wp-includes\functions.php on line 809

    Can you advise how I can fix this please?

  9. Ryan

    April 14, 2010 at 6:03 am

    Awesome! Hopefully 3.0 will already have considered this for the upgrade. Thank you for the help!

  10. Bagel Roar

    May 6, 2010 at 5:03 am

    It was so hard to find information that actually made sense and worked. Thank you for this.

  11. torsak

    May 14, 2010 at 1:15 pm

    Great to work on my site.Thank you.

  12. Gauhar

    June 15, 2010 at 11:57 pm

    Awesome… Thanks for the help. I was experimenting with MU and was stuck. I needed the themes editor. WordPress guys should enable plugins and themes editor by default…

    Thanks a lot for your help…

    Cheers!

  13. Griffin Boyce

    July 1, 2010 at 4:25 am

    Awesome tutorial, really helpful =)

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>