Hi! I'm Allen and I welcome you to my blog. I blog mainly about my blogging experiences where I get to learn how to earn money online through blogging and have fun doing so. To learn more about my blog, you may want to subscribe to my RSS feed. If you have some questions, feel free to ask me by using my contact form. Thank and have a nice day.

Have you encountered a FATAL ERROR in your blog when you tried to add a new function to your blog?

I did encounter this earlier when I was upgrading to wordpress 2.3. The reason for the fatal error is that I am calling a function that does not exist (perhaps the plugin that has that function has not been activated for example, similar_posts() won’t work unless the Similar Posts plugin is activated).

Solution:

There is a very simple solution to this problem so that you can avoid these kind of errors. You just have to make use of the function_exists function in PHP…

Continue with some code…
This is how it works.

<?php
if (function_exists(’FUNCTION_CALL’))
{
FUNCTION_CALL();
}
?>

This code means that before you use the function FUNCTION_CALL, you have to make sure it exists. If that function does not exist, then nothing will happen however, if the function exists, then it will be called and executed.

Through this simple code, I have lessened the probability of getting Fatal errors due to undefined function calls.

Popularity: 1% [?]

Share and Enjoy:
  • Digg
  • StumbleUpon
  • del.icio.us
  • Sphinn
  • Facebook
  • Mixx
  • Google
  • Bumpzee
  • Propeller
  • Reddit
  • Slashdot
  • Technorati