How to Fix Syntax Error in WordPress
This blunder generally happens when you are attempting to add code bits into WordPress and have unintentionally missed something or the code has off base grammar. This will result into a PHP parse blunder and you will see a notification like:
Parse error- syntax error, unexpected $end in /public_html/site1/wp-content/themes/my-theme/functions.php on line 278
The blunder message would demonstrate the unforeseen thing found in the code and the area of the content where the mistake happened with the line number. To fix this issue you should address the grammar. More often than not it is a missing section or some surprising character in the code
Using Proper Syntax to Avoid Errors
The first thing you need to do is to take a gander at the amateur’s manual for gluing pieces from the web into WordPress. This article records some basic slip-ups made by tenderfoots when gluing code in WordPress layouts. The punctuation blunder is generally brought about by a minuscule yet urgent misstep in your code language structure. A missing comma or an extra wavy section can break the whole content.
Did you as of late glue a piece from the web? Refreshed a module? At that point chances are you know precisely where to look.
Fixing the Syntax Error Using FTP
In order to fix the Syntax Error, you need to edit the code that caused this error. You can either remove it or fix the syntax. Often beginners freak out because this error causes your entire site to become inaccessible. If you pasted the code using your WordPress dashboard Appearance » Editor section, then you are locked out. So how do you edit the code? Check out our guide on locked out of WordPress admin. The only way to fix this is to access the file you last edited using FTP (How to use FTP).
After installing the FTP program, connect it to your website, and go to the theme file that needs editing. In case you forgot which file you need to edit, just look at the error code. The error will tell you exactly which file and which line you need to edit.
You can either remove the code you last added or write the code with incorrect syntax. Once you are done removing/editing the code, save the file and upload it back to your server. Come to your WordPress site and refresh the page, and your site will be working.
We hope this article helped you fix Syntax Error in WordPress. Please leave your questions and feedback in the comments