Created
February 21, 2015 01:53
-
-
Save scarstens/840010696caf5cc544eb to your computer and use it in GitHub Desktop.
Example of overriding a "root level" function using a custom class. The example showcases how to override WordPress's pluggable.php function wp_mail, with a custom function.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class wpMandrill{ | |
static function load(){ | |
function wp_mail(){ | |
echo 'custom mail'; | |
} | |
} | |
} | |
wpMandrill::load(); | |
if(!function_exists('wp_mail')) { | |
function wp_mail() { | |
echo 'default mail'; | |
} | |
} | |
wp_mail(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment