Last updated on July 28th, at 07:48 pm
Parse error: syntax error unexpected ‘}’ in functions.php online xxxx, a very confusing and dreaded Warning sign you may get in word press if something goes wrong with your functions.php file.
In this article, I will share a very common a beginner may face. Like changing a theme or pasting some code. The syntax error is usually caused by a tiny but crucial mistake like a missing comma, or an extra curly bracket can break the entire script.
Did you recently paste a code snippet from the web? Updated a plugin? or changed to a different theme? Then chances are you know exactly where to look.
See also How To Deactivate A Plugin When Locked Out Of WP Admin
This could also 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, then you won’t be able to log on to your admin panel also. This can happen in very weird situations.
How I got This warning Parse error syntax error unexpected
In my case, I got this warning after changing to a new theme. 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 the themes displayed the above warning message.
I could not change to any theme, not even to the WordPress default theme.
That was weird, cause all I did was change the theme only (I’m calling it as a 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 online again.
This is how I managed to bring up my site online.
If you face this same problem,( after changing a theme or a plugin) just follow this very simple procedure.
You have to overwrite 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 the main page of your site’s 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 cPanel window.
step 5: 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 then it’s 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 it’s 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 whatever client you use, but I found this to be much easier and worked well.
SUGGESTED READING:
1: 2 Best Google AdSense plugin for word press.
2: FIX your backup folder might be visible to the public.
Hello! I am Ben Jamir, Founder, and Author of this blog Tipsnfreeware. I blog about computer tips & tricks, share tested free Software’s, Networking, WordPress tips, SEO tips. If you like my post /Tips then please like and share it with your friends.
Thank you Ben for sharing . I had this problem too. You make it sound so simple and easy to do that I could correct it in ten minutes. I really like the you explain things. You helped a home user.
Thank you again
Hello Albert ! happy that it was of help to you !