Skip to content

How to Fix a Syntax Error After You’ve Broken Your WordPress Site with the Appearance Editor

While writing a Quick Guide on a different topic, I had the idea that maybe just this once it would be OK to edit my code in the Appearance editor (at “Appearance > Editor” on most WordPress sites.). I should know better after reading all about how this isn’t a good idea, but what can I say, sometimes you just have to learn hard lessons yourself. If you’re curious, here’s where I made my silly mistake:

how to fix a syntax error in WordPress

(click to enlarge)

Unsurprisingly, I found myself with a broken site. In this situation, not only would it not load for visitors, but I also wasn’t able to access the WordPress dashboard to go back to the appearance editor and delete my bad code! (This is, if you didn’t follow the link, the basic reason you shouldn’t use the Appearance editor.)

how to fix a syntax error in WordPress

(click to enlarge)

If you find yourself in a similar situation after breaking your site with the Appearance editor, here’s how to fix it:

  1. Make sure you have three things set up on your computer: a usable file structure, a text editor, and an FTP client. If you don’t have these yet, check out Three Things You Need Before Making Changes to Your CSS. I use a program called Coda that serves as both my FTP client and text editor.
  2. Use your FTP client to locate the server-side file you made changes to in your appearance editor. In this case, I went to: public_html/wp-content/rosemary-child/functions.php. rosemary-child is my child theme folder, you’re is probably different. You’ll also want to make sure you’re editing the file that’s on the server, rather than its counterpart on your desktop. In Coda, you can tell if you’re doing this because “Remote” will be in blue at the bottom of the window.
    how to fix a syntax error in WordPress

    (click to enlarge)

  3. Open this file, and find the code you recently added that is causing the syntax error. The error message on your currently broken site will also point you to the specific line that’s causing the problem. One poorly placed semicolon is all it takes to create this type of problem. If you don’t know what specific issue you introduced, check out these recommendations of what to look for.
    how to fix a syntax error in WordPress

    (click to enlarge)

  4. Once you’ve fixed the code in question, save your changes. If you’re using Coda, you’ll get an alert when your upload is complete, and your server has received and incorporated your changes.
    how to fix a syntax error in WordPress

    (click to enlarge)

  5. Reload your site in your web browser. Whew! If you fixed the syntax problem properly, the error message will be replaced by the page in the appearance editor when you originally made your mistake. Now that you’ve fixed it, step away from the Appearance editor. Make any further edits edits in your text editor instead!
    how to fix a syntax error in WordPress

    (click to enlarge)

Yay! 🎉 You made it to the end of the article!
Harper Phillips

1 Comment
Most Voted
Newest Oldest
Inline Feedbacks
View all comments
Catch Up With the Latest WordPress News – #7 - WP Mayor
March 9, 2016 3:00 pm

[…] WP Shout:  How to Fix a Syntax Error After You’ve Broken Your WordPress Site with the Appearance Editor […]

Or start the conversation in our Facebook group for WordPress professionals. Find answers, share tips, and get help from other WordPress experts. Join now (it’s free)!

1
0
Would love your thoughts, please comment.x

Most Searched Articles

Best JavaScript Libraries and Frameworks: Try These 14 in 2024

In this post, we look at the best JavaScript libraries and frameworks to try out this year. Why? Well, with JavaScript being available in every web browser, this makes it the most accessible programming language of ...

20 Best Free WordPress Themes for 2024 (Responsive, Mobile-Ready, Beautiful)

If you're looking for only the best free WordPress themes in the market for this year, then you're in the right place. We have more than enough such themes for you right ...

12 Best WordPress Hosting Providers of 2024 Compared and Tested

Looking for the best WordPress hosting that you can actually afford? We did the testing for you. Here are 10+ best hosts on the market ...

Handpicked Articles

How to Make a WordPress Website: Ultimate Guide for All Users – Beginners, Intermediate, Advanced

Many people wonder how to make a WordPress website. They’ve heard about WordPress, its incredible popularity, excellent features and designs, and now they want to join the pack and build a WordPress website of their own. So, where does one get ...

How to Start an Ecommerce Business: Ultimate Guide for 2024

Is this going to be the year you learn how to start an eCommerce business from scratch? You’re certainly in the right place! This guide will give you a roadmap to getting from 0 to a fully functional eCommerce business. ...