I am creating a plugin using WordPress plugin boilerplate (https://wppb.me/), I have create a separate file for sending emails under /admin/partials/ directory. but wordpress throw error when I am using wp_mail function in this file. any solution for this?

Fatal error: Uncaught Error: Call to undefined function wp_mail()

1 Answer 1


If it's undefined, that means you're trying to run wp_mail() before it is loaded. Whatever you've hooked it to is too early. Hook your process to a later action. Essentially, anything like plugins_loaded or later.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.