WordPress MU File Editor Revealed
October 18th, 2009 by Keith from shrewdies | Filed under Function.This is no longer true.
The latest version of multiuser WordPress has the standard file editor – it just needs to be enabled.
First, a couple of warnings:
- Editing themes and plugins directly can render your site unusable. It is vital that you have a backup of the file you are changing, AND file access to your webserver to revert to your backup if needed.
- The change will affect all your users who are using the plugin or theme that you are changing
So, there are very good reasons why you should not make ad-hoc changes to plugins and themes. However, if you feel that bypassing version control is occasionally worth the risk, here is how to unveil your hidden file editor.
- Create a file, e.g. file-editor-enabler.php, with the following code:
<?php
add_action( 'admin_init', create_function('$pages', 'if(is_site_admin()) return remove_action("admin_init","disable_some_pages");'),1);
add_action( '_admin_menu', create_function('$theme_menu', 'return add_theme_page( "Editor", "Editor", "edit_themes", "theme-editor.php");' ));
add_action( '_admin_menu', create_function('$plugin_menu', 'return add_submenu_page( "plugins.php", "Editor", "Editor", "edit_plugins", "plugin-editor.php");' ));
?> - Upload that file to the mu-plugins directory.
That’s all you need to do. Any code put in the mu-plugins directory is automatically executed.
My thanks go to dsader at the WordPress MU forum for this excellent tip.
thanks a lot for this.