Português do Brasil •
(Add your language)
There are times when you will need to edit the WordPress files, especially if you want to make changes in your WordPress Theme. WordPress features a built-in editor for editing files from within your browser whilst online: The Theme Editor. You can also edit files copied or stored on your computer and then upload them to your site using an FTP client.
Before editing any of your WordPress files, check the following:
- BACKUP! And Work from Backups
- Work from copies of backup files when possible and/or make sure that you backup your information frequently as you work and make changes. Keep backups in a safe place.
- File Permissions
- When working online, you need to set the appropriate file permissions to modify and save them. If you see a note at the bottom of the WordPress Built-in Editor panel that says "If this file was writable you could edit it.", this means you need to change the file permissions before you can make any changes.
- Use a Text Editor to Edit Files
- To make changes to files outside of the built-in Plugin or Theme Editor, use a text editor. DO NOT USE A WORD PROCESSING PROGRAM. Word processors change the quote marks to characters and may convert other characters or bring in unwanted code; these changes will cause the file to break. There are also some HTML generator programs that should not be used for similar reasons.
Using the Theme Editor and Plugin Editor
WordPress contains two built-in editors that allows you to edit Theme files directly from within your browser. They are called the Theme Editor and Plugin Editor.
Access the Theme Editor from the Administration >
Appearance > Editor menu.
The Plugin Editor is located at
Plugins > Editor.
To view a file in these editors, click on the file from the right-hand side list.
More information on editing themes is available at Theme Development and Using Themes. You can learn more about editing plugins at Writing a Plugin and Plugin Resources.
Be aware that if the theme you edit is updated, your changes will be overwritten. To better organize your changes and protect them from updates, consider creating a Child Theme in which to keep all your changes.
What Files Can Be Edited?
From within the WordPress Built-in Editor, the following file types may be edited, if writable:
- TXT (and related text-like files such as RTF)
Things You Need to Know
- Instant Changes
- The changes you make to files using the WordPress editors are instant; the changes happen online, in real-time. You and any visitors to your will see the changes immediately.
- Because of the immediate nature of the changes, it's usually safer to edit copies of your files offline, test, and upload your changes when they are verified.
- Always make sure you have a current backup before editing files.
- Editor Features
- The built-in WordPress Plugin and Theme editors are very basic, allowing easy access to view and edit plugin and theme files on your site only. There are no built-in editor features for search and replace, line numbers, syntax highlighting, code completion, or other advanced editing features.
- Hint: Use your browsers internal search to help find code within the visual editors.
- File Permissions
- To edit a file using the built-in WordPress Plugin or Theme Editors, the permissions for that file must be set to writable (at least 666). You can change the permissions on files by using a FTP client program, web-based file manager provided by your host, or from the command-line using SSH (secure shell). Your options depend on the type of access your host offers.
- Make a Mistake? Use the Backup Files
- Backup all files before editing. If you make a mistake that causes errors, a site crash, a blank screen, or blocks access to your WordPress Dashboard, delete the changed file and replace it with a good one from your backup.
- No backup? Download a fresh copy of the file you edited from the original source, replace it, and start over. BACKUP FIRST.
- Security Warning
- By default, any user that logs in with administrative permissions can access the WordPress Plugin and Theme editors, and change any theme or plugin file on your site in real-time.
- To combat accidents, errors, and even hacking, you may wish to disable the ability to edit files within the WordPress theme by adding the DISALLOW_FILE_EDIT function to your wp-config.php file.
Editing Files Offline
To edit files offline, you can use any of the recommended text editors to create and edit files and an FTP client to upload them. Make sure to view the results in your browser to check if the desired change has taken effect.
Note: It is not recommended to change core WordPress files other than wp-config.php. If you must change anything else, take notes and store them in a text file in your WordPress root directory and make a backup copy of them for future reference and upgrades.
Using Text Editors
Editors to Avoid
Note: If you use an external editor to create and edit files, such as a standard word-processor, it can corrupt the file you are editing. See Text Editor in the Glossary for a short explanation on why you should avoid these editors.
Editors to avoid include:
- Microsoft Word
- Apple iWork Pages
- Microsoft Publisher
- Microsoft Works
- Microsoft Excel
- Adobe Photoshop
- Adobe Illustrator
- Adobe Dreamweaver
- Any do-it-yourself instant web page software.
To use Adobe Dreamweaver or Microsoft FrontPage, keep these guidelines in mind:
- Adobe Dreamweaver: To make sure your files work properly, delete Dreamweaver content, copy your content from the WordPress editor, and paste it into the Dreamweaver file.
- Microsoft FrontPage: Do not use built-in templates. Avoid Internet Explorer-specific code.
The following Text Editors are acceptable for file editing:
- BBEdit (Classic Mac OS, Mac OS X, $$$)
- Boxer Text Editor (Windows)
- Coda (Mac OS X, Shareware)
- Crimson Editor (Windows, Freeware)
- EditPad (cross-platform)
- EditPlus (Windows)
- Editra (cross-platform, Open Source, Free)
- emacs (Unices, Windows, Mac OS X, Open Source, Free)
- Fraise (Mac OS X, Open Source, Free, based on Smultron)
- gedit (Unices)
- JEdit (cross-platform)
- Kate (Unices)
- Komodo Edit (cross-platform, Open Source, Free)
- Kwrite (Unices)
- Notepad++ (Windows, Open Source, Free)
- phpDesigner (Windows)
- pico (Unices)
- PSPad (Windows, Free)
- Smultron (Mac OS X, Open Source, Free/$) Smultron 4 (req OS-X Lion) (v.cheap in MacApp store)
- SubEthaEdit (Mac OS X, $)
- Sublime Text 2 (Windows, Linux, Mac OS X)
- TextEdit (comes with Mac OS X)
- TextMate (Mac OS X, $)
- TextPad (Windows)
- TextWrangler (Mac OS X, Free)
- vim (Unices, Windows, Mac OS X, Open Source, Free)
- Notepad2 (Windows, Freeware)
- WebTide Editor (Windows, Linux, Mac OS X, Freeware, Java)
The following IDEs are acceptable for file editing: