Quantcast
Channel: Topic Tag: plugin | WordPress.org
Viewing all articles
Browse latest Browse all 26892

ianhaycox on "Undefined Function Fatal Error In Plugin Class"

$
0
0

If foo() is in a class are you calling it correctly ?

e.g. within the plugin class,

$this->foo();

or from outside the class, you need a class instance,

$x = new MyPluginClass();
$x->foo();

or make foo static,

MyPluginClass::foo();

Once foo() in is functions.php, depedning how it's declared, foo() is probably in global scope, so just calling

foo();

would work.

Ian.


Viewing all articles
Browse latest Browse all 26892

Trending Articles