How to Edit WordPress Safely

Stop SignNot too long ago, someone emailed me for some advice on how to fix their website. They had been editing Thesis with the built in custom file editor. After saving a change they made, the website would not work anymore and was spitting out errors. The gentleman told me that he had talked to some freelancers that had bid as high as $400 to fix the website.

I ended up helping the gentleman fix his error and get his website running again. The lesson here? Programming isn’t easy, and if you’re not careful you can easily make an expensive error. But, there are ways that you can protect yourself in case you make a mistake while editing your WordPress.

I’ll be the first to admit that when I started working with WordPress I would do what I have heard called “cowboy editing”. This is where you use the built in editor for WordPress to edit your themes. The problem with this is that if you make an error, it can bring your site down, and then there is no simple “undo” available. When you use a text editor, you can easily make edits while still giving yourself the ability to “undo” any mistakes you make.

Combine a Text Editor With an FTP Program

Filezilla Screenshot

Now, there are two ways that you can use a text editor to make edits to your website. Some text editors have built in FTP functionality, which makes this a little bit easier. But, you can also get the same functionality if your FTP program has edit capability. Let’s describe the FTP program editing first.

I will describe how to do this using Filezilla since this is an open-source project that can be used on both PCs and Macs. In Filezilla, you:

  1. Connect to your server.
  2. Navigate to the directory of the file you want to edit is in.
  3. Right-click the file and select view/edit.
  4. Edit the file in your text editor.
  5. Save the file in the text editor.
  6. Switch back to Filezilla and approve the upload.

 

Use a Text Editor With Built-in FTP

Espresso Screenshot

That’s not that bad is it? But, there is an even easier way to edit your files. Use a text editor that has built in FTP capability. Now, I use Mac, and I am only comfortable giving suggestions for software that I have used. For that reason, the next two programs I recommend are going to be for Mac. There are suitable solutions for PC also, but I will allow others to recommend their favorite text editors in the comments.

With that said, I recommend two programs for Mac – Espresso and TextWrangler.

TextWrangler is a free, basic text editor that is available in the Mac App Store. This program is is simple, but has some powerful features, including:

  • Multiple undos
  • State save if you accidentally quit the program
  • Periodic auto-save
  • FTP and SFTP support
  • Open multiple documents in a window
  • and more

As you can see, TextWrangler is a pretty powerful text editor, especially for being free! But, I personally use another program on my Mac.

When I am doing web development, I use Espresso from Macrabbit. Espresso has many of the same features of TextWrangler, but I like the extra features it has, such as:

  • CSSEdit3. This is tool that will help you create CSS for your website.
  • Code sense and code folding. Code quicker and manage your code.
  • Sync capability. Upload a file as soon as you save.
  • Live styling. See updates in real time
  • and more

Using either one of these editors, you can easily make an edit and upload it to your server. If your change breaks your website, simply undo and re-upload. If you combine this with only making small edits at a time, you will be able to pinpoint exactly where your bad code is. Sound nice, eh?

Conclusion

After reading this article, I hope that you now think that editing your article in a text editor is simple! Using a text editor, instead of the built in WordPress editors, will save you frustration and headaches when you inevitably make a coding mistake.

Have questions or input? Leave a comment below!

Sign Up Now for Free Updates and Exclusive Content:

Learn how to write killer content, get more traffic, make money, and more by entering your email below:

Written by Eric Binnion

Eric Binnion is a computer science student at Midwestern State University. When Eric is not online, he is usually volunteering in his community or enjoying time with his family. You can find Eric on Twitter.

Comments

  • Keith Davis says:

    Hi Eric
    Good advice.
    Perhaps I would add – make sure you have a backup copy, just in case.

    I’ve add a few problems with Filezilla using the view / edit so what I do now is download the file, edit it and upload.

    takes a few seconds l;onger, but better to be safe.

  • Good info. I agree, and would add that either:

    1.
    WordPress should remove the possibility to edit theme files via the WordPress admin UI, since a simple php syntax error can easily bring a whole site down.

    2.
    Include a php syntax checker, that notifies the user of potential problems before deploying the edit live.

    3.
    Offer some other means to recover, without having to use FTP. The people who usually edit their themes via the WP admin UI, often doesn’t use FTP clients. Otherwise they’d edit the files with a text editor and upload via FTP.

    Great blog you have btw!

    Oliver