Errors and Solutions


What is syntax error? What should I do if I encounter WordPress syntax error? The most annoying error that many users using WordPress have experienced is the “Parse error: Syntax error, unexpected” error. Most of the users who encounter this error are scared. They directly think everything I did was right but why did I come across this error? Will all my efforts go to waste? These are things like now. When you encounter such situations, I strongly recommend that you enable the WordPress debug mode to find out which file is causing the error.

If you have just started using WordPress, I would like to point out that the “Parse error: Syntax error, unexpected” error will annoy you for a few days. Syntax error occurs because your version of PHP is not complying with syntax rules. In this article I have prepared for you, I will explain in detail what to do when you encounter a syntax error.

What will you need?

You will need the things I will mention below in order to be able to follow the steps I have described.

  • Providing access to the hosting where you host your site files.
  • Any FTP client.

What is syntax error?

Solving the WordPress Syntax Error

Find the Wrong File

Let’s Edit the File with FTP Client


What is syntax error?

Beginners most often wonder what syntax error is. Syntax error occurs because of the programming language that you use cannot read the syntax rules. In other words, the compiler cannot process the line of code you have written. You may encounter a syntax error because you forgot the semicolon at the end of the line of code you usually wrote, or because you misspelled any file path. If you have encountered a syntax error on your WordPress site, it means that there is an error in the code line you added while making changes to any file on your site.

Solving the WordPress Syntax Error

Syntax errors are errors that can be easily fixed in WordPress. It just wants a little bit of code knowledge. There are two important steps to fix such errors.

  • Identify the line or lines of code that caused the error.
  • Edit those codes that caused error by connecting to your hosting server.

Let’s examine these steps in detail;

Find the Wrong File

When you encounter errors such as syntax errors in WordPress, the first thing you need to do is to identify the lines of code that cause error. Especially, we need to know in which file the problem occurs. To learn this, you must activate the WordPress debug mode.

When you encounter such errors, you should first check the theme or plugin files required for your site in order to follow the correct path. If you get a syntax error after installing any plugin or theme, you don’t need to look for the error in another file. It is already clear which is the faulty file.

If you don’t know which of your website’s files is causing the error, then you don’t have to worry. When you try to access your website via any browser, if you see “Parse error: Syntax error, unexpected” error, next to the error text, it writes in which file the error is and on which line in that file. This is how you can find the file you need to take action in order to solve the syntax error.

When our website gets a syntax error, you can see which file has the error, as in the example below.

/home/u694443746/public_html/wp2/wp-content/themes/twentyseventeen/single.php on line 43

We can see which file is causing this error and where and in which line in that file. This line will be enough to solve the WordPress syntax error.

Let’s Edit the File with FTP Client

Now that we have identified the file and code that caused the error on our website, we can begin to make the necessary changes in the file caused error. If you can’t use View> editor paths from your admin panel to fix the error-causing code, you need to use any FTP client. FileZilla will help us for the operations we will do.

Editing our corrupted file is very simple. Connect to the server that has your site files via FTP. Then find the problematic file we have identified and enter it. In the example I have given for you; “/Home/u694443746/public_html/wp2/wpcontent/themes/twentyseventeen/single.php” Since the problem we encountered was in the single.php file, we entered the single.php file.

At this step, you have to make a choice, if you wish, delete the faulty code completely from there or make the necessary changes in that code to make it work. Of course, take a backup of your file and if you have code information, I recommend that you to make changes on the code.

I suggest you improve the code. Because when you delete the line, there may be many lines of code linked to that line, and this may cause those lines of code to break.

Now let’s take a closer look at our file that caused the error. In the error message we encountered, it showed that the error was in line 43. Let’s see the line of code that caused the error on line 43.

php get_footer()

In this line, the get footer function is called. We were encountering a syntax error because we did not indicate the end of the line of code-  the semicolon was missing at the end of the code.

In the example we gave you, we solved the error by adding a semicolon to the end of the line that caused the error. By following the methods I have explained, you can solve the error in the file and upload it back to your server via FTP, and get your website. If you are a beginner in PHP, you can easily use the PHP code checker to circumvent the syntax error or check the PHP syntax errors that are usually made.


I recommend people who are just starting to use WordPress not to panic when they encounter syntax errors. In fact, this problem is a problem that can be solved very simply with only a small knowledge of code.

If you want to get professional support for WordPress errors and solutions, you can reach me from social media tools and contact page.

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button