sol
sol

Reputation: 385

Call a method in a PHP class from wordpress functions.php

I have a separate PHP class called MyClass.php. I need to call a method in that class and send it a variable. This is what I have in functions.php:

function email_submission($entry, $form){
    MyClass::addEmail($entry["2"]);
}

//Fatal error: Class 'MyClass' not found in /path/wp-content/themes/mytheme/functions.php

What am I missing?

Upvotes: 0

Views: 1794

Answers (1)

Bang Dao
Bang Dao

Reputation: 5102

try add this line require_once 'MyClass.php';

Upvotes: 1

Related Questions