Editing Files

From 워드프레스(WORDPRESS) 한국어 위키

Jump to: navigation, search

Contents

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 two built-in editors for editing files from within your browser while online: The File Editor and 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, to modify the files they have to be set for the appropriate file permissions to allow modifications. 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 changes to the file.
Use a Text Editor to Edit Files 
If you will be making changes to files outside of the built-in [[]]File 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 which will cause the file to break when used. There are also some HTML generator programs that should not be used for similar reasons.

Using the File Editor

WordPress contains a built-in editor to allow editing files directly from within your browser while online. It is called the File Editor.

Access the built-in File Editor from the Administration > Manage > Files Panel.

  • To view a file in the File Editor, click on the file from the list or type in the specific address such as example.com/wordpress/filename.php
    • If the file is "writable", able to be changed, you will see a button at the bottom of the editing window that says "Update File". Click this when you are done with your edits and ready to save the file.
    • If the file is not "writable", you will see a note under the bottom of the editing window telling you the file is not writable. You will need to CHMOD the file to 666 in order to make it writable through an FTP program (preferably FileZilla) before you can edit it.
  • Before editing, backup your file by saving a copy!
  • Inside the File Editor window, you may make changes to the file. Edit with care as to not delete or harm the code inside the file.
  • When ready to save the file, click the button at the bottom: Update File. This will save the file.

Using the Theme Editor

WordPress contains a built in editor that allows you to edit theme files directly from within your browser. It is called the Theme Editor.

Access the Theme Editor from the Administration > Presentation > Theme Editor Panel.

To view a file in the Theme Editor, click on the file from the list.

More information on editing themes is available at Theme Development and Using Themes

Editing Files

To edit files offline on your computer, again, be sure the original file is backed up, and using any Glossary#Text editor, open the file and make the changes.

If you will be changing any core WordPress files, 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.

After saving the file, upload it to the appropriate folder on your WordPress site using an FTP client. Then view the results in your browser to check.

What Files Can Be Edited?

From within the WordPress Built-in Editor, the following file types may be edited, if writable:

  • HTML
  • PHP
  • CSS
  • .htaccess
  • TXT (and related text-like files such as RTF)

Things You Need to Know

File Permissions 
To edit a file through the Built-in Editor, the permissions for that file must be set to 666. You can change the permissions on files by using a FTP client program, web-based interface provided by your host, or from the command-line using telnet or ssh (secure shell). These options are dependent on the type of access your host offers.
Instant Changes 
The changes you make in the WordPress editors are instant and you do not need an FTP client program. You are changing the files online. You and visitors will see the changes immediately.
Make a Mistake? Use the Backup Files 
Backup all files before editing. If you make a mistake, copy the file back onto your site from the backed up files. No backup? You will need to download WordPress, your Theme, and whatever files you need to replace and start over. BACKUP FIRST.
Make a Bigger Mistake? Delete. 
If the changes you make cause your site to "crash" or gives you a blank screen or screen filled with errors, if you cannot access your Administration Panels, delete the changed file and replace it with a good one from your backup.

Use Cautions With These Editors

DO NOT use these for editing your WordPress files at all, ever, really, DON'T:

  • Microsoft Word
  • WordPerfect
  • ANY word-processor
  • Microsoft Publisher
  • ANY Do-It-Yourself Instant Web Page Software

Use these only if you are very familiar with them:

  • Dreamweaver - it's best to copy from the WordPress editor, replacing what Dreamweaver puts in new files by default.
  • FrontPage - watch out for extra code inserted by FrontPage, and don't try to use its built-in templates ... also watch for IE-specific code which can make your site look or act unexpectedly in certain browsers, which you want to stay away from, because you want your website to be viewable in ALL browsers possible, so make sure you take out the IE-specific code, or else your blog will be doomed to failure. So, just watch out all the time for all IE-specific code, and DELETE it immediately, or else your blog will be dooomed to failure.

Recommended editors are listed at the Text Editor Section of the Glossary

This article is marked as in need of editing. You can help Codex by editing it.

Personal tools