1

My web host company blocked my website - they said, there are many files infected, and they also gave me the names of all those files.

One of them is my themes functions.php file, but they said I have to delete all of them.

My question is, will that effect my website appearance? I mean, if I delete the functions.php, will that destroy my theme functionalities?

2
  • If you delete functions.php you will run into many errors since lots of WordPress functions are defined there. Resulting your website will practically inaccessible. So instead deleting these files, replace infected files with your backup. Commented Sep 7, 2015 at 14:24
  • What version is your WP? When you last updated it? Commented Sep 7, 2015 at 20:29

4 Answers 4

2

In all propability this infection is not restricted to functions.php only. Non Wordpress files on your server might be infected as well as well as your wp-config.php and your db. Hackers do quite a good job when they hack a site.

Simply deleting (which will in all propability break your site leaving you with WSOD) and replacing functions.php will most propably never fix your issue, and if it even solve the issue, it will definitely not be long before you encounter the same issue, so the whole exercise will be useless.

You need to work through your theme and close the loop holes, this is VERY VERY IMPORTANT. Also, hire a professional, it will be worth it, to totally get rid of the infection and to work throught your theme and give you advice on possible loop hole.

Also make sure you are up to date with PHP and Wordpress versions

2
  • You are correct, should have stated it better to say that it will in most propability lead to WSOD. Will update my answer appropriately. Commented Sep 7, 2015 at 16:03
  • And most probably the database is infected as well. Some strange new users maybe. Some new passwords. Better have a backup ready. Commented Sep 7, 2015 at 20:26
1

This depends on the theme. Most themes do make use of the functions.php file, so yes, it most-likely will make a difference to the appearance of your site. Your best bet is to update your theme with the latest version available from the developers. This will replace the infected functions.php file with a fresh, untainted, copy and all of the problems should go away. You may also want to setup automatic updates, or give yourself a schedule to make such updates yourself regularly.

1
  • 1
    Deleting functions.php will make a difference in appearance, it will in all probabilty just break your site and make the page white ;-) Commented Sep 7, 2015 at 14:45
0

Do not delete the function.php in your theme. It will destroy the themes functionality complete. The function.php has the widget area codes and lots of other miscellaneous PHP code that is needed for your theme to work properly. If you delete it your theme will be destroyed and you could experience WSOD (white screen of death) and some error codes like could not find function.php or something.

So in other words if you delete your function.php it will destroy your theme and cause errors all over your website resulting in you having to delete your theme.

0

Just to add this a general note, the functions.php can be deleted without any harm, as the WordPress codex states:

A theme can optionally use a functions file, which resides in the theme subdirectory and is named functions.php.

Because the usage of the functions.php is optional, deleting it is generally and theoretically no problem. For this the functions.php can't contain any functionality needed – of course.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.