WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Just tried to make an edit to the functions.php on my site. As is often the case, wp didn't like it and threw a fit, locking me out of making any further changes.

So now I have to use ftp to edit out the offending code.

You could argue I should be more careful / expert at coding, but the question is:

Isn't there an easier way to recover from messing up with a functions.php edit than having to ftp?

share|improve this question
up vote 4 down vote accepted

Here's a much better solution: Don't edit the theme's functions.php file. Don't put your custom code into that file either.

If you have snippets of code for a site, put them into a custom plugin. Put each one into its own plugin, in fact. Separate them by functionality.

I even made a handy dandy plugin to make this easier, called Pluginception.

The nice thing about editing plugins in the WordPress plugin edit screen: If you screw it up and cause a fatal error, WordPress will detect it and disable the plugin. This might break your site, but it probably won't break the admin screens and you can fix your error and reactivate the plugin.

Don't worry about the number of plugins. That's totally irrelevant. The code is what matters. The code has the same impact whether you put in a bunch of easily separated plugins or whether you shove it all together into one functions.php file that is dangerous to edit.

share|improve this answer
Thanks for the advice Otto - Trying to learn but so often the tut says "add this to functions.php".. Will try out your plugin - thanks! – speedypancake Jul 16 '14 at 17:50
Please pass this link along anytime you see a tutorial suggesting that. Even I suggested this sort of thing in the past, however we were all wrong. Themes should remain themes and not receive random code for random reasons. – Otto Jul 16 '14 at 18:04
Thanks to both who answered. I had thought there might be a way to avoid leaving the site and re-editing functions.php via ftp. Apparently not, but I have learned something more useful - to not develop in a live site environment, and also to not mess with the functions.php in the first place. I am marking Otto's answer as my preferred option because his plugin has given me a much better and safer way to experiment with new code and ideas. Thanks again to both :) – speedypancake Jul 16 '14 at 20:40

Of course there are better ways to do that. You could use some local installation with a copy of your online website with software such as WAMP, XAMP, etc to make your changes.

"Cow Boy" coding is never a good solution. If you miss one ; boom! Fatal error! And in your case this is live.

You could also use better process such as git workflows to have a better control and roll back if there's some bug.

share|improve this answer
Thanks jMau - googling "git workflows" now... – speedypancake Jul 16 '14 at 16:07

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.