Overriding pluggable functions in a plugin
21 Dec
There is a small detail you need to remember when trying to override a pluggable function in a wordpress plugin – The original function will not be overridden in plugin activation time, which means that the following code will make the plugin activation to fail with a redeclaration error message
function override() {
...
}
What you actually have to do to take care of this situation is to protect the function declaration by checking whether the function is already declared
if (!function_exists('override') {
function override() {
...
}
}
Thanks! This helped me a lot!