How to Solve WordPress Parse or Syntax Error
Does your blog’s screen went white and prompting Parse error: Syntax error, Unexpected? I know if you are a newbie blogger or someone who is new to write codes it feels like a heart attack when you see this kind of error. Even I feel the same when I saw this error for the first time on my blog. It happens with me because I changed some codes on my WordPress blog. I assume that you are here because you are facing the same error on your website and searching for its solutions. If you encountered the same error, then you don’t have to worry so much because you are not the one who is facing it for the first time.
Well, this error occurs because you have recently changed some codes on your website. In this case, it becomes a little bit easy to solve this error because you know the actual location to resolve this and you can solve it by changing that code to actual one.
But, many times it stops you from getting into the admin dashboard of your WordPress blog. So, today in this article I am going to provide you all of the possible ways to solve this WordPress Parse or Syntax Error.
Steps to solve WordPress Parse or Syntax Error
If you are facing this error, the first thing you have to do is finding the file causing this error. Well, it is very easy to find because all you just have to read the tagline attached to the error, and that’s it.
Like, if you look at the attached screenshot, you will see that the html_functions.php is the file which is causing this error on its line 14. Also, you will get the exact location where this file has been placed in your WordPress directory.
Now, all you have to do is just update the code that you have changed recently to the old one or try to solve that by pasting the correct one. But almost whenever this error occurs, it also block us to get into the WordPress dashboard. At this condition, all we have to do is to solve it using FTP for solving the code. That is the reason why I have added two different methods. So, here the guide starts
Method 1. (When you can access the WordPress Dashboard)
First of all, try to visit your WordPress admin’s dashboard to check that you are blocked to access dashboard or not. If you can access it, you just have to follow few steps mentioned below to get rid of this error.
- Simply visit the dashboard and hover over the appearance.
- Now click on the Editor and locate the file causing this error. (In my case, this file is html_functions.php)
- Now move to the line where the error is showing and try to solve it. Either you can use the original code(which you have modified) or add the working code for solving the error.
That’s it guys, You have successfully solved this syntax error but wait, What if you are not able to access this WordPress dashboard? Don’t worry, below I have added an alternate method which will work every time. The best part of this method is, it does not require to log in to the dashboard.
Method 2. Fixing the file using FTP
For this method, you have to enter in the root directory from your host. If you are using a host which provides you cPanel, then you can access it from your cPanel dashboard otherwise you can use this any other FTP client such as FileZilla or WinSCP. Because of I set up a xampp network on my PC for giving you the solution of this error, I am using FileZilla. If your host doesn’t provide you access to the cPanel, you can too use FileZilla.
There is a great post on how to fix it on 000webhost blog post
Before proceeding to the tutorial, simply download FileZilla from this link.(Skip if your web host provides you cPanel because you will get FTP access from there.)
- Open FileZilla and enter the required details of your website and if you are using cPanel, log in there.
Details you have to enter in FileZilla-
Port- Leave Blank
Protocol- FTP(File Transfer Protocol)
Encryption- Only use Plain
Username- Enter the username that you use to log into your web host or cPanel.
Password- Enter the password connected with your username.
- Now, you have to navigate the corrupted file. In my condition, the file is located on C:\Xampp\htdocs\testing\website\include\html_functions.php
- Now right click on the corrupted file and click on View/Edit.
- After this, the corrupted file will open in the default text editor. Now you have two choices, either you can remove the corrupted code, or you can make the possible changes to ensure that it will work properly.
- Now save the file.
That’s it. Now your site will start working again. There are so many reasons why this error occurs. Even, sometimes a small semicolon can lead you to this error so before making changes to any codes, make sure you have changed it correctly. Also, take a backup before applying any changes.
So, these were the solutions to solve this WordPress Parse or Syntax Error. You can solve it easily by using the methods given above. Sometimes these error occurs because of installing a new theme or a plugin. This happens because your theme and plugins are not compatible with each other. In this case, you just have to delete the recently installed plugin. Also, below I have provided few tips to play safely while changing codes on your site. Make sure to read that part of this article and apply while changing the codes again. 😉
Tips for changing codes safely
- Always make sure to take a backup before applying any changes on your website. So, if the error solving takes time, you can make your site running again quickly by restoring it.
- For themes and plugins, never use any nulled one. Always download plugins from the trusted source.
- Always test the code before proceeding with it. Over the internet, there are thousands of websites allow you to check and run the codes online.
- Be careful to check the location where you have to enter the code. It is pretty easy to paste the code into the wrong location.
Solving the syntax error is not a very tough task to perform. It can be difficult if you are coding for the first time. A syntax error is one of the most common error, and almost every third guy had received it. If you face it, all you just have to keep calm and follow the steps given above.
So, hope you guys have like this article. If this article helps you in solving this error, share it with others. Also, you can share your queries in the comment section below.
- May 2019 (11)
- April 2019 (21)
- March 2019 (11)
- February 2019 (15)
- January 2019 (9)
- December 2018 (5)
- November 2018 (6)
- October 2018 (8)
- September 2018 (9)
- August 2018 (11)
- July 2018 (10)
- June 2018 (12)
- May 2018 (11)
- April 2018 (10)
- March 2018 (6)
- February 2018 (12)
- January 2018 (12)
- December 2017 (2)
- November 2017 (14)
- October 2017 (13)
- September 2017 (7)
- August 2017 (16)
- July 2017 (9)
- June 2017 (10)
- May 2017 (21)
- April 2017 (13)
- March 2017 (5)
- February 2017 (3)
- January 2017 (4)
- December 2016 (1)
- November 2016 (4)
- September 2016 (1)
- August 2016 (2)
- July 2016 (8)
- June 2016 (5)
- May 2016 (7)
- April 2016 (19)
- March 2016 (18)
- January 2016 (1)
- December 2015 (11)
- November 2015 (2)
- Business4 weeks ago
CRO for Beginners: Why Your Conversion Rate Is Low and How to Improve Them
- Software3 weeks ago
Music Notation Software for Free Music Composition
- Business3 weeks ago
Build the stunning online reputation with the support of a certified company
- Business4 weeks ago
3 Tips to Create Business Videos on a Small Budget
- Business4 weeks ago
Debunking Five Popular Videoconference Myths
- Apple2 weeks ago
Best Features Of MacBook That I Mostly Like
- Business3 weeks ago
How Does Packaging Add Value For Consumers And Retailers 2019
- technology2 weeks ago
Best Privacy practices in 2019