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 wordpress themes, this file is used by Word Press to initialize the theme.
If you get this error from your word press functions.php itself, than you wont be able to log on to your admin panel also. This can happen in very weird situations.
I just wanted to change my theme on my blog, so I changed it to a very popular WP theme. 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). But now whenever I clicked for “Live preview” all of them displayed the above warning message.
That was weird, cause all I did was change the theme only (I’m calling it as rogue theme) which (probably) caused some changes to all the other themes functions.php file.(later I found out)
For more than an hour I had to struggle to bring back my site to online again. This is how I managed to bring up my site online.
If you face this same problem, just follow this very simple procedure, you have 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 select the folder “wp-content” click on the “+” sign which will expand. Find the “Themes” folder and click on the “+” sign of the themes folder.
The folder will expand to display all the themes installed on your site. Select the theme which caused this error. 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 Functions.php (which you opened earlier) 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.
( updated 17 May 2015 )