WordPress syntax error makes your site inaccessible to you and your readers. Although this issue can be an annoyance, the good thing is the error message tells you exactly where to look to resolve it, so it is often pretty easy to fix. This tutorial will show you how to fix WordPress syntax error and return your site to full function.
In this article:
- Steps to Fix WordPress Syntax Error.
Steps to Fix Syntax Error in WordPress
Syntax error usually occurs after you make some changes to your website.
You may have installed a new plugin or theme, or you may recently have made some code edits to add certain features to your WordPress site.
Depending on the changes you made, you can quite easily pinpoint the source of the error, and make the needed corrections to fix it.
When you recently installed a plugin or theme
If you recently added a plugin or theme to your website, your best bet would be to remove these new additions to return site functionality.
To do this, you would need to manually disable the new plugin or theme. Use these guides to learn how.
If you recently made code edits to your site
Since your dashboard cannot be accessed, you would need to access your site files and make edits using an FTP client.
Fixing the Syntax Error using FTP (File Transfer Protocol)
This video guide shows you how to use FileZilla FTP to access your files. You would need your cPanel details for this and you can contact your web host for the details if you do not already have them.
After successfully accessing your site with FileZilla, go back to the error and look at the location of the script causing it.
Usually its “parse error: syntax error, unexpected” as shown in the image below.
Next, go to the location of this script in FileZilla.
Right-click on the affected file and select View/Edit.
Locate the changes you recently made to that file. If you have some technical knowledge, you can try to figure out what the problem is. Very often it is a missing semi-colon, closing bracket, etc.
On the other hand, you may simply remove the entire code you recently added.
Next, save and close the edited file. You will be prompted by FileZilla to upload this file. Click Yes.
Now refresh your site and the error should be gone.
WordPress syntax error can seem like a difficult problem to fix. But as you may have found out, it is actually pretty easy.
We hope you learned how to fix syntax error in WordPress. Also, if you were trying to add a feature when this occurred, you can let us know the details and one of our developers will install the proper code you need.
On the other hand, if you are still experiencing the syntax error problem, we can help you with that as well. Simply request our help by contacting our WordPress Support Service.
- WordPress User Roles: Beginner’s Guide
- Top WordPress GDPR Compliance Plugins Compared
- Integrate Stripe in WooCommerce using WooCommerce Stripe Payment Gateway Plugin