Install
This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.
Install straight from GitHub with WP-CLI:
wp plugin install https://github.com/amrshah/wp-plugin-monaco/archive/refs/heads/main.zipA powerful code editor plugin for WordPress that integrates Monaco Editor (the same editor that powers Visual Studio Code) directly into your WordPress admin panel.
Features
- 🎨 Modern Code Editor - Full Monaco Editor integration with syntax highlighting
- 📁 File Explorer - Browse and manage files with an intuitive tree view
- 🔒 Secure Access Control - Configurable folder whitelist and capability-based permissions
- 💾 Auto-Save - Automatic file saving with configurable delay
- 🎯 Multi-Tab Interface - Work on multiple files simultaneously
- 🌙 Theme Support - Light, dark, and high-contrast themes
- 🔍 IntelliSense - Code completion and suggestions
- ⌨️ Keyboard Shortcuts - Familiar shortcuts like Ctrl+S to save
- 🛡️ WordPress Integration - Uses WordPress REST API with nonce authentication
Installation
- Download the plugin ZIP file or clone this repository
- Upload to your WordPress plugins directory (
wp-content/plugins/) - Activate the plugin through the 'Plugins' menu in WordPress
- Navigate to Code Editor in the admin menu
Configuration
Folder Access Whitelist
By default, the plugin allows access to:
wp-content/themeswp-content/plugins
To configure allowed folders:
- Go to Code Editor > Settings
- Under Folder Access Control, add or remove folders
- Click Save Changes
Important: All paths are relative to your WordPress root directory and restricted to within the WordPress installation.
Security Settings
Configure who can access the editor:
- Required Capability: Choose which WordPress capability is required (default:
manage_options) - Allowed Operations: Enable/disable specific operations:
- Read Files
- Write/Edit Files
- Delete Files/Folders
- Rename Files/Folders
- Create Folders
Editor Preferences
Customize the editor appearance:
- Theme: Light, Dark, or High Contrast
- Font Size: 10-24 pixels
- Auto-Save: Enable/disable with configurable delay
Usage
Opening Files
- Navigate to Code Editor in the WordPress admin menu
- Browse folders in the left sidebar
- Click on a file to open it in the editor
Editing Files
- Open a file from the file explorer
- Make your changes in the editor
- Save using Ctrl+S (Cmd+S on Mac) or wait for auto-save
Multiple Files
- Open multiple files by clicking on them
- Switch between files using the tabs at the top
- Close tabs by clicking the × icon
- Modified files show a dot (•) indicator
Keyboard Shortcuts
- Ctrl+S / Cmd+S: Save current file
- Ctrl+F / Cmd+F: Find in file
- Ctrl+H / Cmd+H: Find and replace
- Ctrl+Z / Cmd+Z: Undo
- Ctrl+Shift+Z / Cmd+Shift+Z: Redo
Security Best Practices
- Limit Folder Access: Only whitelist folders that need to be edited
- Restrict Capabilities: Use the most restrictive capability that meets your needs
- Disable Dangerous Operations: Consider disabling delete operations if not needed
- Regular Backups: Always maintain regular backups of your WordPress site
- Use on Staging: Test changes on a staging site before applying to production
- Monitor Access: Keep track of who has access to the editor
System Requirements
- WordPress 5.8 or higher
- PHP 7.4 or higher
- Modern web browser with JavaScript enabled
Browser Compatibility
- Chrome/Edge (latest)
- Firefox (latest)
- Safari (latest)
- Opera (latest)
Troubleshooting
Editor Not Loading
- Check browser console for JavaScript errors
- Ensure your browser supports modern JavaScript
- Try clearing browser cache
- Disable other plugins that might conflict
Cannot Access Files
- Verify the folder is in the allowed folders list
- Check that you have the required capability
- Ensure the folder exists and is readable
- Check file permissions on the server
Auto-Save Not Working
- Verify auto-save is enabled in settings
- Check that write operations are allowed
- Ensure you have write permissions on the file
Development
File Structure
wp-monaco-editor/
├── wp-monaco-editor.php # Main plugin file
├── includes/
│ ├── class-admin-menu.php # Admin menu integration
│ ├── class-admin-page.php # Admin page renderer
│ ├── class-filesystem-api.php # REST API endpoints
│ └── class-settings.php # Settings page
├── assets/
│ ├── js/
│ │ ├── api-client.js # REST API client
│ │ ├── file-explorer.js # File tree component
│ │ └── monaco-editor.js # Monaco Editor integration
│ └── css/
│ └── admin-page.css # Styles
└── README.md
REST API Endpoints
All endpoints are under /wp-json/wp-monaco/v1/fs/:
GET /list?path=<path>- List directory contentsGET /read?path=<path>- Read file contentsPOST /write- Write file contentsPOST /delete- Delete file/folderPOST /mkdir- Create directoryPOST /rename- Rename file/folderGET /stat?path=<path>- Get file stats
Changelog
1.0.0
- Initial release
- Monaco Editor integration
- File explorer with tree view
- Multi-tab interface
- Auto-save functionality
- Folder whitelist security
- Settings page
- WordPress REST API integration
License
GPL v2 or later
Support
For support, please open an issue on GitHub or contact the plugin author.
Credits
- Built with Monaco Editor
- Inspired by Visual Studio Code
- Developed for WordPress
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Disclaimer
Use at your own risk. This plugin provides direct file system access. Always:
- Backup your site before using
- Test on staging environments first
- Restrict access to trusted users only
- Monitor file changes carefully
Made with ❤️ for the WordPress community