How to Fix the Syntax Error in WordPress website
- by linda Y
- in WordPress
- View 28
Typically, this happens because a snippet of code is placed within a theme file incorrectly or the code itself contains an error such as a character or a tag in the wrong place or missing it altogether.
After making changes in your WordPress site, you may see syntax errors or parse errors in your web browser. These usually look similar to:
Parse error: syntax error, unexpected end of file in
/wp-content/themes/twentyseventeen/functions.php on line 430
The moment syntax error in WordPress occurs, you’re locked out of your website. It means that there is no chance you can undo the mistake you’ve just made in any plugin or theme file using the WordPress dashboard.
How to Fix the Syntax Error:
There are two ways you could fix the said error:
- Fixing Syntax Error Through FTP
- Fixing Syntax Error Through Control Panel
Fixing Syntax Error Through FTP
Simply use an FTP client and access your WP files. We are taking FileZilla as an example to show how this is done. Download FileZilla on your computer and fill the necessary information to access your website.
Follow the path given in the syntax error message:
Find the file or folder that’s causing the issue, right click on it and choose Edit to make the necessary correction (add or remove code):
Once you change the code, a message stating “File Has Changed” will pop up on the screen. Press ‘Yes’ and refresh your site URL, and it will start working correctly.
Fixing Syntax Error Through Control Panel
You can fix the syntax error through cPanel as well. All you have to do is log in to cPanel and look for an option of ‘File Manager.’
In ‘File Manager’ you need to go to ‘Code Editor’ and look for the exact line of code where the change is needed.
Edit the file and click on ‘Save Changes.’
We hope this article helped you fix the syntax errors you have in WordPress.