How To Fix Syntax Error In WordPress

How To Fix Syntax Error In WordPress

Last modified: March 18, 2020

FAQ
Cloudways

When you’ve made some changes to your WordPress site, you might get a syntax error or a parse error. This is shown in your web browser and can be rather scary. The typical message is something like this:

Parse error: syntax error, unexpected end of file in /wp-content/themes/twentyseventeen/functions.php on line 432

This error happens when there is a typo or code that has been incorrectly pasted into the file. You need to fix this by going into your file and changing that code. The good news is that unlike some other errors, you have the exact location of the problem.

Show More

* This button will show the rest of the post and open up an offer from a vendor

Step One: Open Up Your Website Files

The first thing you need to do is to open up your website files. You should use an FTP client like FileZilla. Once inside, go to the file which was noted on the error screen.

Step Two: Download The File

Download the file where the error is and open it up with a text editor. You can get these free on most operating systems. You could also invest in some text editors that are designed for website files.

Step Three: Locate The Error Line

Now locate the error line. When you’re talking about hundreds of lines of code this can be an issue, but it is worth the time investment. If you’re using Notepad, it is easy to find the line by clicking on ‘Edit’ and selecting ‘Go To’. This will open up a dialogue box that you can type in the line number and it will take you there.

If you’ve invested in a high-end text editor, then the line number might be located on the left-hand side of the text.

Step Four: Find The Error

Now you need to find the specific error for the line. This is usually a missing or extra character. Once found and edited, you should save the file and reupload it, replacing the original copy of the document.

Step Five: Test Your Website Again

Now test the website. If you’ve found the right error, the error screen should go.

You might find that there is another syntax error after you’ve found the first one. Or the error code might give you two or three errors on the same document. It might take some time to fix this error or it could be really simple.

Step Six: Another Solution

If you’ve found that the syntax error has been because of a new plugin/theme, one of the best solutions is to remove that plugin. This prevents the error happening again when the author does an update and accidentally keeps the original error in the coding.

Though you should also contact the plugin developer to speak to them about the error.

Don’t Shy Away From Fixing Syntax Errors

Syntax errors might seem daunting, but the truth is that they are relatively easy to solve. Just follow the guide about and your website will be working again quickly.

Recap:
Save 4 Later
Email liked links to yourself