Every plugin requires certain codes to insert within the WordPress theme template files to make them work. What will you do, If you are not a PHP programmer and you activated the plugin then after some time due to one or another reasons the plugin crashes or you deactivates the plugin and forget to remove the function code you have inserted in your templated. Any reason, the reasult will be the same and will cause your site to crash.
Here is a simple step, to make your site more robust against plugin crashes or in an uneventfull situation, where you have disabled a plugin and forget to remvoe its funtion call from the template.
Normally, you are asked to include a code block similar to this:
<?php some_funcname(arg1,arg2…etc.); ?>
The some_funcname in the above code is an example to represent a function which the plugin wants you to include; the arguments may or may not be required, it all depends on the function.
So here we go, we will make an small addition to the function, which to take care of both of the problems as described above. Look at the modified code:
<?php if(function_exists(’some_funcname‘) @some_funcname(arg1,arg2…); ?>
Remember to replace some_funcname with the actual name of the function.
Here if(function_exists —Tests for the existence of the function and ensures that the code isn’t executed when the plugin is inactive / disabled. This prevents the first problem.
Appending an @ before the function name ensures that errors, if any, while executing the function are ignored and do not cause further problems. This fix works against all versions of WordPress and also in any other templating system which uses PHP code.