WordPress Errors

How to Fix the Syntax Error in WordPress

A syntax error message might be generated after an update such as a plugin, a WordPress theme or an edit to one of your WordPress files. All it takes is a simple recurring error, and you can generate this error message.

To show you how this error works, I am going to generate this error. As you can see, our WordPress website looks great, and everything is fine. So let’s create this error. Again, many times if are updating or uploading a plugin or a theme, you could get a conflict to cause the error.

Many times though, you could find that if you are updating a WordPress file, all it takes is missing a comma for the error to be generated. So let’s do that now.

As you side note, if you are only making changes to your WordPress files, it would be beneficial to make a backup. Ok, so I am simply going to Appearance and then to Editor. I am simply going to go and a choose file. I am going to choose the functions file, and as I here in the function.php file, you can see there are many lines of code.

You have semi-colons, you have parenthesis, you have dashes and many items here. To show you how simple it is to get this error, I am simply going to delete this comma. I am going to update the file, and now the website will break.

Not that you want to have a WordPress error, but compared to other WordPress error types this one is beneficial because it lets you know where the file is that is affected. This helps you as you were making changes to your WordPress files; you know where to go find it. If I simply try to refresh to go back to the main domain name, I cannot log in. So, we must find an alternative way to edit the file.

For this demonstration, I will be using Filezilla.

Filezilla is a free FTP solution that you can download to your computer and transfer information between your computer and your website server. Since we cannot login to our WordPress platform, we need to be able to get in there via FTP.

Simple login to your website and since our error lets us know where the file is located at. We are just going to follow the command. Once you are where your file is, you have multiple options. You can drag it over and edit directly on your computer.

You can right click on it and download it, or you can right click on it and view and edit. Now, I have no pad connected to my Filezilla. You may need to connect a text editor to your Filezilla. So, I am simply going to right-click, click view and edit and my notepad initializes. This text editor will allow us to fix our errors as we go down, I see where the error was, and I can simply paste it. Again, if you know where the error is that you are working on your website; you can simply go back and fix it. I am going to file, click save, closeout and then refresh the website. As you can see, that fixed the website.

Again, if you work on your WordPress platform; there might be times you work on files. You may add too much code, not enough code or enter a command that conflicts with your WordPress platform.

Now, if you do not have access to FTP, but you do have access to your cPanel, let’s try this again using your cPanel. I am simply going to regenerate this error. I am going to Appearance and then to Editor.

I am going to find the functions file, and now I am simply going to delete something else. Last time I deleted a comma, this time I will delete a semi-colon, and I am going to update the file. Once again the website has crashed.

You can see the syntax error here letting you know where the file is and in which line. So this time, we are going to log in through our cPanel. Once you have logged in, to your cPanel dashboard, look for a file named File Manager. Once you are here, simply follow the path that the error message gave you.

Once you have found the file, simply go to the code editor. Now that you are here, you have options between choosing between the lines of code and using a text editor like notepad.

Again, since we were making editing changes just like you might be adding changes to your WordPress files. We know exactly where to go, what to delete and how to proceed. I am simply adding the coding back in, and clicking on save changes. I will go back to the website and refresh and once again, the website has been fixed.

Download 3 WordPress themes & plugins​ with lifetime access for FREE!