1

I've mistakenly deleted the functions.php file of my Twenty Sixteen WordPress Theme running the command below:

rm  /var/www/html/wp/wp-content/themes/twentysixteen/functions.php

The Twenty Sixteen Theme is my currently active theme and as such, my WordPress site is no longer accessible as it used to be (ref. screenshot below).

enter image description here

How do I fix it?

  • I don't think you can restore it unless you are using any code versioning tool like git or svn and have your last changes committed there. – Prasad Nevase Dec 22 '16 at 14:53
  • 3
    If there was no change in functions.php file then you can simply download the theme from here and copy paste the file from downloaded zip to above path. – Prasad Nevase Dec 22 '16 at 14:55
  • Backups: saving you from mistakes such as this by design. – jdm2112 Dec 22 '16 at 16:03
1

To fix your site, you should get another functions.php.

As such, you can get that from your most recent and operational backup and upload it unto the location of the mistakenly deleted one.

In case you don't have a backup, your last option will be to download a fresh copy of your theme; once that done, extract and upload the functions.php file it contains unto the location of the one you've mistakenly deleted from your server.

In the later case (should you have edited directly your functions.php - which is not a recommended practice), you cannot recover any previous modifications performed on the file.

Should you consider editing the Twenty Sixteen WordPress Theme or any other one from the WordPress Repository or any other source, I will recommend you create a Child Theme of the theme you intended to use for that purpose, rather than editing the actual theme directly.

| improve this answer | |
0

You can always re-download the Twenty Sixteen theme from the official Theme Directory and restore the functions.php file. You'll lose any edits you have made to the previous file

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.