Parse error: syntax error,unexpected—— in functions.php on line—, a very confusing and dreaded Warning sign you may get in word press, if something goes wrong with your functions.php file. This could happen if you are manually trying to change or modify the code in functions.php file. In themes, this file is used by Word Press to initialize the theme.
If you get this error from your wordpress functions.php itself, than you wont be able to log on to your admin panel also. This can happen in very weird situations, why I’m saying this ? I just wanted to change my theme on my blog, so I changed it to a very popular WP theme (I’m not naming the theme here, downloaded the theme from word press repository).The theme got installed, but I didn’t like the look so decided to revert back to my old theme, that’s when I started getting this warning message.
Parse error: syntax error, unexpected ‘}’ in /home/xxxxx/public_html/wp-content/themes/catch-box/functions.php on line 1108
I had more than ten themes installed (all working) ,whenever I clicked for “Live preview” all of them displayed the above warning message. That was weird, cause all I did was changed the theme only (I’m calling it as rogue theme) which (probably) caused some changes to all the other themes functions.php file.
For more than an hour I had to struggle to bring back my site to online again.If you face this same problem, just follow this very simple procedure, to over write the functions.php in the root directory with a fresh copy,(word press or theme) it worked for me.
step 1: First download the original file, if its word press download it, if it’s a theme file download it and save it on your hard disk.
step 2: Log on to your sites cPanel and from the dashboard scroll down and select “File manager”
step 3: From the Directory selection option select “Web Root(public_html) and click on the go button. You will be taken to main page of your sites root files, which contains all the important files and folders.
step 4: On the left panel search for the folder “wp-content” click on the “+” sign which will expand, Scroll down find the “Themes” folder and here click on the “+” on the side of the themes folder which will expand to display the names of all the themes installed on your site. In my case it was the “Catch theme” which I selected.
Here don’t click on the “+” sign, just double click on the themes name, which will open all the files for that theme and displayed on the right side panel of the window.
step 5: As you can see in the image here, select the functions.php file and from the right click context menu select “edit” it will open a new window with all the code of functions.php file in editable mode. If you are a coder, expert in php than its here that you can edit and correct the error, but for a beginner and for those who do not know anything about coding (that includes me) go to the next step.
step 6: This is the last and crucial step. Don’t worry its simple, in the edit window select all the codes in the functions.php and delete it. Now go to that folder where you have downloaded the theme file earlier (or word press installation file) open it and find the functions.php file, right click on it and choose to open with “notepad” once notepad opens the file, copy all the code, now go back to your cPanel edit window and paste the entire code there. Click on save changes button, once its saved close the window. Log out of cPanel.
Now try to log on to your wp-admin page, it should work now, or if it was a theme which was the problem (as it was with me) go to the themes page and check
NOTE: Many users use ftp file transfer, if you are comfortable with that, do so with what ever client you use, but I found this to be much easier and worked well. I have deleted all the themes and reinstalled them, all’s well now.
Was this article helpful ? share your experiences with us to help others.
1: Best Related post Plugin for a WordPress Blog.
2: 3 Easy steps to earn money with nRelate.
3: 2 Best Google AdSense plugin for word press.
4: FIX your backup folder might be visible to Public.
5. 5 Reasons why you should use windows Live writer.
Ben Jamir – has written 266 posts on this site.
I hope you found this post useful. I am a Part time, but a passionate Blogger. a Tech Lover Your source for Windows Tips,Tricks, tutorials and quality Freeware for everyday use | A Tech Blog from TNF.