WPMandrill & WP Security Audit Log WP_Mail Plugin Conflict

Clowns Are Not Confined To The Circus

It happens very now and then, 15 minutes left in the day and some clown wants to hit the update button on a critical piece of software. Change control? We don’t need no stinking change control. What can go wrong?

Today was one of those days and I was wearing the clown makeup. 

In my defense, we did test the updates on the the development server, and it showed the problem but in my haste, I did not notice the problem. You’d think this post is about change control and I can imagine that in this story there is a sermon in there somewhere. This post is about what we learned from the problem. 

The Problem: WP_Mail Already Defined

So the dust has settled from the update and just when I thought the update went about as good as it gets, there it was was:

“Mandrill: wp_mail has been declared by another process or plugin, so you won’t be able to use Mandrill until the problem is solved.”

This error means that some other chuck of code defined the function WP_Mail and WPMandrill is playing nice by not re-defining the function. What is WP_Mail – its the email handler for WP and it is defined AFTER all the other code gets a chance to define it. That is the theory anyway. 

After searching the code base for instances of “function wp_mail”, I found exactly two!  One in the WPMandrill plugin and one in pluginable.php from the core WP core files.  That wasn’t exactly what I expected. So the function didn’t appear in any other plugin and the function wp_mail from pluginable.php must have been called by a plugin.  Let the digging continue. 

Another recursive grep finds that a plugin, “security audit log”  calls pluginable.php, which contains the definition of wp_mail. Reading from WordPress’s docs

Pluggable functions were introduced in WordPress 1.5.1 These functions let you override certain core functions via plugins. The most up-to-date list of core functions that WordPress allows plugins to override is available at wp-includes/pluggable.php. WordPress loads the built-in functions only if they are undefined after all plugins have been loaded.
Pluggable functions are no longer being added to WordPress core. All new functions instead use filters on their output to allow for similar overriding of their functionality.

We found the culprit  – deactivating “WP Security Audit Log” solved the conflict! I’ve contacted the author of the WP Security Audit Log to see if they can let the two plugins co-exist.


I received a reply from the author of WP Security Audit Log and they’re looking into it. 

To Be Continued…