HOME >> How To Wordpress >>

How to avoid wordpress plugin functions break your theme after upgrade?

Posted on date Feb-21-2013 · by author  · comments 2 Comments 

Hi Friends,

A friend told me that he upgrade his plugin and then…, his wordpress theme shown something like this:


Fatal error: Call to undefined function functionname() in /home/somefolder/public_html/yourdomainhere.com/ wp-content/themes/mytheme/single.php on line 15

his site messed up and he do not know how this happened. I do a check for him and I found he hired a guy call a plugin’s function in his theme, and he have a good habit that always upgrade his plugin and theme to the newest version, but this time his plugin have a big change and the naked call function is not existed in the lasted plugin, so….

Dears, if you hope call a function form a plugin, please remember use this kind of method:

< ?php
if ( function_exists( 'yourfunctionname' ) ) {
    yourfunctionname();
}
?>

So if this function do not existed, your theme will works normaly yet, is this helpful? Happy day.

Best Regards,
Tomas

2 Responses to “How to avoid wordpress plugin functions break your theme after upgrade?”

  1. Bruce Silverthorne says:

    Thanks for the great tooltip plugin. I found your tooltips_list_shortcode($atts) function, and was wondering is there was a way to modify this to render a sorted list of the definitions on a page. I cant edit the file in Admin.

Leave Your Comments

CAPTCHA
*