You know it: That terrible moment you hit save and refresh your browser only to see a white screen of death. You’re not the first victim and you won’t be the last. Below are some tips to help you avoid the white screen of death (or at least know what to do when it happens) when editing your WordPress site.
Ok, so you find a tutorial on the web (or maybe even this site) and you think I can do that! I want to try this customization! Before you dive head long into editing your site files, here are some tips to follow.
Tip 1: Use an FTP Client to Access Your Site Files
Repeat with me: Never use the built-in WordPress file editor. I won’t bore you with all the reasons the built-in editor is a bad idea, but here’s the #1 reason: If you get a white screen of death, there’s no way to access your site via wp-admin anymore.
You’ll have to get into your site via FTP (or SFTP or your host’s cPanel and file manager) to fix the offending file, so save yourself the trouble and start with an FTP client.
Think of an FTP client as a dual-screen where you see your computer’s files on one side and your server’s files on the other. It’s a simple way to manage files.
There are about one billion FTP clients available for free online. If you already have a favorite, go for it. If you need a recommendation, here are a couple:
Tip 2: Use a Text Editor with Syntax Highlighting
If you’ve used the built-in WordPress editor to modify files, your head will spin with the magic and beauty of using a proper text editor. Text editors offer a ton of benefits to help improve your coding workflow, but one of my favorites is syntax highlighting.
When you’re copy/pasting code you’ve found on the web, you’re susceptible to all kinds of syntax errors (i.e. a single quote gets transformed to an apostrophe that crashes your site). Using a text editor with syntax highlighting makes it easier to spot these mistakes before you save them to your site.
As with FTP clients, there are a TON of text editors available (both free and premium). My goal isn’t to get you to use a particular editor, but simply to get you in the habit of using one at all. Here are a couple of my favorites to get you started:
Tip #3: Don’t Edit a Live Site
This is a hard one. I’m tempted to do it, so I figure you are, too. But here’s the deal: Unless you’re using trusted code (i.e. code you have already tested out in a local or development environment), you risk taking your live site down. Save yourself the horror!
What do I mean when I say “live” site? A live site is any site where visitors are expected.
If you’re developing on a live URL (i.e. it’s out there for the world to see, but you’re not driving traffic to it, then I’d call that a development site). Bottom line is, you don’t want to make real-time edits to a site people are using.
Set up a development environment.
There are so many routes you can take to getting a development environment and there’s not necessarily a right or wrong way to do – it just depends on your workflow. Here are some quick examples:
You need a development site where the client can peak in:
In this case, you need a live server to test on. I keep a hosting account at WPEngine (aff link) just for this purpose. I can spin up a WordPress install with the click of a button, set up SFTP access and go to town.
Of course you can do this with any host, but WPEngine makes it easier (i.e. I don’t have to wade through a cPanel to create a subdomain, a database, etc – all that is done automatically).
You need a local development site:
If you’re comfortable getting your hands a little dirty, you can install WordPress locally on your Mac, Windows, or Ubuntu. WPExplorer just released a great series on installing WP locally on each of these platforms. I’ve used this method and it certainly works.
But then, a few months ago I was introduced to Desktop Server from ServerPress.com. It’s easier to set up (if the idea of creating a database scares you), but the realllllly cool features are the ability to clone sites. So, for instance, I set up what I like to call my “default install” with everything configured just like a Carrie likes it and I can clone that same setup over and over, saving me time every time I spin up a new WP install.
I digress a bit and probably need to write a full review of Desktop Server in another post, but for now just know it’s an alternative to a manual local install.
Tip #4: Have a Backup Ready to Go
Most problems we create by editing site files can easily be remedied by opening up the offending file, removing whatever customization we added, and re-saving.
But what about CATASTROPHIC FAILURES? In the event of a major catastrophe, you will thank yourself a million times over for having a backup of your site files and database. Before you go to the trouble of doing a full site restore, however, make sure that you’re experiencing a catastrophic event and not just a problem that could be fixed by going in and reverting whatever change caused the problem.
For example, if updating a plugin caused your site to tank, go deactivate that plugin. If you can no longer access your WordPress admin dashboard, log in to your site via FTP and go to wp-content/plugins/ and find the offending plugin. You can either delete it from there or just rename the folder. If that was the source of the problem, that maneuver will likely get you back on course. If it doesn’t then maybe there is a database issue and you need to do a restore.
At any rate, make your future self love you by getting your present self to create regular backups of your sites. I use ManageWP and BackupBuddy (affiliate link bombs – watch out!), but if you don’t mind a more manual approach, there are plenty of free plugins/alternatives available.
Tip #5: Don’t Panic
I’ll end with this tip and it’s probably the most important. When your site tanks and words that would embarrass a sailor fly through your brain, don’t panic.
Take a deep breath.
Do your best to troubleshoot.
Finally, learn from your mistakes and set yourself up for success by implementing a proper system for editing your WordPress site.