Support » Fixing WordPress » After editing functions.php – can't login to WP dashboard

  • I was trying to edit WP admin bar and I found a code, which I had to paste into my functions.php. So, after I did this, i attempted to logout, but it redirected me to a blank white screen. Then I manually followed my website login link, was able to put my credentials into login fields, but again it redirected me to white screen. I deleted everything I put in my functions.php, but the problem still exists.
    Help! How can I get back into my dashboard?

Viewing 5 replies - 1 through 5 (of 5 total)
  • First thing I would try is to replace the functions.php file with the original one from a fresh download of the Theme you are using.

    If that doesn’t work, you can rename or delete the directory where your Theme is located using an FTP client or your hosting company’s control panel’s File Manager.

    WordPress will notice it is missing and switch you to the default Theme (Twenty Fourteen).

    If you would prefer to know what the problem is before doing this, you can set WP_DEBUG to TRUE in wp-config.php and you will then likely get an error message rather than the White Screen Of Death (WSOD).

    Thank you for your reply!
    I followed your suggestion and replaced functions.php file. Now I have access to my dashboard, which is great! But what do I do with an old functions.php? Can I replace it back or what?

    From now on, I would suggest that you make a rule to always keep a backup copy of any file you change, so you can quickly get access to WordPress again.

    Throw away your old functions.php file, and try to make the changes to the new one, after you have kept a backup copy of the new one.

    Well, I try to to back up regularly. It’s just weird that, I pasted a small piece of code, which I deleted afterwards and it still didn’t resolve the problem.
    I don’t have much in my old functions.php since its from my child theme. Can I just copy those pieces of code I had before in my old functions.php to the new functions.php?

    Yes, regular backups are important, too. But I was suggesting something more akin to Change Control, where you keep Old and New copies of each file that you change, each time you make a change, a processing known as Versioning.

    I would also suggest a tool like NotePad++ for actually making the chanages as it gives you some syntax checking of the PHP code, and also allows you to compare different versions of a file, and to display otherwise unprintable characters that may have snuck into the file.

    Certainly you can copy code across from the copy of the functions.php that failed, but you risk introducing the same error again.

    You may even consider learning enough PHP to recognize coding errors. I learned PHP from php.net, but there are good free on-line tutorials that most people will prefer. I started programming computers in 1971, so what works for me might not work for others.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘After editing functions.php – can't login to WP dashboard’ is closed to new replies.