Why you shouldn’t use the WordPress code editor

One of the coolest and most talked about features for WordPress 4.9 is the enhancements made to the code editor for plugins and themes inside the admin area. Before 4.9, the editor was simply a large text area field with no lines and no knowledge. Now, there are line numbers on the left, syntax highlighting, auto-completion and lets you know of potential site-killing errors. But before you go and use it all over the place for everything, you want to take heed: no matter the enhancements made, do not use the WordPress code editor. You’ll still find a way to get the dreaded “white screen of death”, a PHP that kills your site, and you won’t know how to fix it. So don’t do it.
This is the current WordPress code editor for themes and plugins.

Problems with the editor

The WordPress editor included in version 4.9 is better than what was there before, but it’s still not perfect and it’s still not really an option for editing PHP. And the main issue isn’t really something WordPress can fix. The main issue with the editor is that it’s attached to the website itself. It’s built right in. So if the site goes down because of a PHP error you just made, good luck trying to get your site back up. There’s no way you can get back into the code editor to undo that change. You’ll need to get in via FTP or your host’s file manager and figure out what to undo to resolve the issue. And for people who aren’t familiar with code, that can be a headache. I know because I did that when I first started with web development and WordPress. Don’t be like younger me. And sure, the new version of the editor shows you syntax errors that will take down the site, but it won’t catch everything. Unassigned variables, things not being set properly can also cause the white screen of death. And then the stress level rises. So when in doubt, find a different option.
This was the code editor before WordPress 4.9.

FTP is a much better option

If you’re wanting to change something in your PHP files, the optimal option is to use FTP. FTP, or File Transfer Protocol, is essentially a connection between your computer and the server where your files are being hosted. Typically, to access those files, you’ll need a FTP manager like Filezilla or Cyberduck. FTP remains unaffected by any PHP or other code that’s going on with your site. You’ll always be able to get into your site’s files via FTP no matter how bad your code is. And that makes it the perfect candidate to make your PHP changes in. You might make a mistake or two and your site will likely show the white screen of death, but you can access your files to edit it. That’s something you can’t do with the WordPress code editor. If you have any questions about how to use FTP, you can read this great guide from WordPress.org. There’s also the possibility of using your host’s file manager if they have one. Any host that uses cPanel should have a file manager, which acts sort of as a mini-FTP application inside your browser. You can upload, download and edit all of your files just like you would with FTP. So if your host has it, you have no excuse for not using it.
The best way to edit your code is through FTP with an FTP manager like Filezilla, shown here.

But there is one good use

So I’ve spent the entire post bashing the code editor in WordPress, but there’s one good use for the editor: CSS. CSS, or Cascading Stylesheets, essentially lays out how the page will look in the browser. While it can control what is shown on the page, it doesn’t handle any data, and, most importantly, it can’t create errors that produce the white screen of death. That makes it a perfect candidate to make changes in the WordPress code editor. While it would really take a lot of work, you can theoretically destroy your site with CSS. It would make your site look really bad and unusable. But even with terrible CSS, your site’s still up, the data is still there and you can get to the admin to fix it all up. That’s something you can’t do if you screw up the PHP. So, if you need to make a quick change to a style on your site, go ahead, use the code editor. But if you need to change something in the PHP for your site, please, stop yourself, go use your web host’s file manager or FTP. Do not use the WordPress code editor. Please.