This is confusing because I've checked other answers and applied them, but I still keep getting this fatal error.
I'm using phpmailer in wordpress and have this code:
if (!class_exists('PHPMailer')) {
require_once(ABSPATH . 'wp-content/uploads/phpmailer/_lib/class.phpmailer.php');
}
The page doesn't load, however, and I get the error:
PHP Fatal error: Cannot redeclare class PHPMailer in
(I also tried class_exists('PHPMailer', false)) but that also produced the same error.)
As far as I can see, by checking the class does not exist and then using require_once I shouldn't have this problem.
But I do...
Any help appreciated.