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.
Ready?
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:
- Core FTP LE (Windows)
- FileZilla (Mac)
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:
- Notepad++ (Windows – there’s also a Mac version now, too, but I’ve never used)
- Sublime Text (Mac)
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.
Pingback: How to Add Rotating Background Images to Your WordPress Genesis Child Theme - Winning Agent
Pingback: How to Change the Property Details in AgentPress Listings - Winning Agent
Pingback: AgentPress Listings Search Results changed after WordPress 4.0 Update - Winning Agent
I know this is an old post, but wondering what your recommended workflow is when using the Dynamik theme in a local install (via Desktop Server.) I’ve used the custom area to create hook boxes, add functions, etc. rather than a text editor to edit full files directly. Is that acceptable or risky?
Hey Michele! As long as you’re doing that development locally, you’re safe. Should you white screen something, you can quickly recover and nobody but you will ever know. 🙂
If you’re using those editing tools on a live site, however, you really don’t have any more protection that using the built-in WP editor.
If you’re working with a host that has a staging server, that’d probably make for the easiest workflow. First-time deploy is with DesktopServer and any future edits use your host’s “copy live to staging” feature. Make the changes on staging and then publish back to live.
I’ve never had much luck with Duplicator. 9 out of 10 times the archive ends up timing out.
Another good rule, don’t touch any PHP code without first setting WP_DEBUG to true.
Awesome post! Glad you use Sublime Text too 🙂
Hi Carrie, thank you so much for the post! One quick question if you have the time: how do you edit the files using a text editor (Sublime) and have the changes be made to the website? There seems there must be a better way than copy and pasting from the editor in wp! Thank you for all your help!
Hey Luke, you’d want to use some sort of FTP program to transfer the files between your local machine and your web host. Your host will provide the information you need to connect to your account via FTP.