Call to undefined function error in plugin

You can try following while you get such error:

  • Searched for the php file with the function definition in it.
    Verified that the file exists.

  • Verified that the require (or include) statement for the above file
    exists in the page. Also, verified the absolute path in the
    require/include is correct.

  • Verified that the filename is spelled correctly in the require
    statement.

  • Echoed a word in the included file, to see if it has been properly
    included.

  • Defined a separate function at the end of file, and called it. It
    worked too.

Problem :

  • Your function is probably in a different namespace than the one
    you’re calling it from.

Solution :

$this-> refers to a function that belongs to the class and is declared within the class, same thing applies for variables declared inside the class. Inside the class it’s called $this->function(), If public outside the class it’s called $theclass->function()