Connect with us

Wordpress

How to Solve WordPress Parse or Syntax Error

Published

on

How to Solve Wordpress Parse or Syntax Error

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.

How to Solve WordPress Parse or Syntax Error

How to Solve WordPress Parse or Syntax Error

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.
Fixing the file using FTP

Fixing the file using FTP

Details you have to enter in FileZilla-

Host- yourdomain.com

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.
FileZilla

FileZilla

  • 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.

Final Words

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.

Praneet is the CEO and Editor of the website TeckFly.com. He is a blogger and have varoius blog on various topic and he is from India who loves to read and write about Technology, Gadgets and Gaming. If you share the similar interests then you can follow him on Facebook | Google+ | Twitter

Click to comment

Leave a Reply

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

Resources

Trending