WordPress syntax error is a common error to see, especially if you’re a beginner. Just like other cases, WordPress too demands right coding. On finding a wrong one, it can’t process what it is supposed to. This is where you see a message on the screen saying, “Syntax error, unexpected…”
In case you’re getting one, here’s a very easy and useful tutorial to fix syntax error in WordPress on your own. Before we jump to the fix, let’s find out the reason you just see the above error message while working on your website.
Why do you Face the Syntax Error in WordPress?
Usually, new WordPress users face this error due to a very simple reason: they pasted an incorrect code to your dashboard Appearance » Editor section. Not only new users but advanced ones too, see this error when they try something new on their WordPress and during that process use an incorrect or incomplete code. For example, if your code doesn’t include a necessary semi-colon, you’ll receive a syntax error.
So, basically, it can be very small error that triggers this error but since it can result in so much time wastage and website reputation, you must resolve it fast.
The first suggestion we give to users is that paste your codes from the web very carefully to your WordPress, taking care you’ve not missed anything which can ruin your script.
However, don’t freak out! It’s a simple error and you can resolve it on your own.
How to Fix Syntax Error in WordPress
You can fix the syntax error using FTP where you can modify or remove the wrong code. Since you can’t access your website when facing this issue, you need to use an FTP client. Filezilla is a popular FTP client. However, you can browse and find many other too which users rely on for their service. So, choose it yourself.
Once you have downloaded and installed your FTP app, run it to edit the code. For that, you need to connect it with your website just the way it asks. Once done, head to the website’s theme file. If you don’t know which theme file you were using, you need to see the error message again to know which file to reach. This is the file which needs editing to fix the fix syntax error in WordPress.
Once inside, match the code with the original one (from the source where you were copying it). If it doesn’t match it due to even a single comma, you need to edit your file’s code exactly as the original one. If you have any confusion just remove the wrong code from your file and save the file.
After saving the edited file, upload it to the server again. Open your WordPress website and refresh it to see if the error message. “Syntax error, unexpected…” is gone and you can access your WordPress now. If should be alright by now.