Why it’s a Good Idea to use SFTP When Editing your Functions.php File

Don't get locked out of WordPress

Using an FTP SFTP, SSH, or code editor application — like Coda or Notepad++, is always a better idea than using the built-in editor inside WordPress.

The reason being is that WordPress doesn’t check for fatal errors in your code before saving it. It becomes very easy to lock yourself out of WordPress if you create an error in your code and suddenly your Dashboard goes blank.

It happens all too often and it causes people a lot of issues.

So before you start editing the code, make sure you’re doing the editing in an application that won’t lock you out.

Comments

  1. Thanks for the tip Jonathan. How about using file manager in cPanel?

    • Jonathan Dingman says:

      I generally avoid any web-based editors for development, simply because they’re usually a pain to use. However, it the cPanel file manager editor will work much better than the WordPress one because it doesn’t depend on WordPress functioning 100%.

  2. A big +1 here Jon. While it can be useful at times… I don’t think the majority of WordPress users are well-informed that editing this file could take down their site completely and lock them out if they don’t have FTP access, etc.

    • Jonathan Dingman says:

      Thanks for the post idea Scott. It’s always a good idea to be suggesting to users what is best practice to help keep their site and data secure.

      As Mark suggested on Twitter, web hosts should eliminate the use of FTP entirely — sending passwords in clear text over http is very insecure.

  3. DOH ><, sorry can't help but find this a little be amusing – not for those who have had the issue but just the thought of it happening!

    • Jonathan Dingman says:

      A lot of people are just unaware that it’s a bad practice, but yeah, nice to chuckle once in a while laughing at ourselves about having b0rked a WordPress installation a time or two ;)

      I’ve done it myself, unfortunately. It was primarily because I didn’t have access to any other method besides direct editing. I learned to keep a good, working version of the page, open in another tab so I could override the functions.php with something good if I needed to. But again, BAD PRACTICE to be using the built-in editor for editing the functions.php ;)

Trackbacks

  1. [...] Warning: Always edit your wordpress theme files in an external text editor!  This will save you tons of headaches if you make a mistake. The built in core WordPress file editor doesn’t store previous file versions and if you mess up something, it’s going to be a pain to fix. [...]

Speak Your Mind

*