• I read a WP “how to” thread on overriding a function.

    I am trying to override a function that exists in pluggable.php. I am under the impression that all I needed to do is name my function the same thing as it is named in pluggable. Because pluggable (supposedly) first checks to see if the function exists, it will not try to recreate an instance of it. That was my understanding from reading the PW thread.

    So I went to activate my plugin with the identical function name that exists in pluggable and I got an error:

    Plugin could not be activated because it triggered a fatal error.
    Fatal error: Cannot redeclare wp_new_user_notification() (previously declared in /home/abcd/public_html/blogs/wp-includes/pluggable.php:1182) in /home/abcd/public_html/blogs/wp-content/plugins/my_new_user_notification/plugin.php on line 30"
Viewing 16 replies (of 16 total)
  • Whew… glad we worked through that….

    As you said, it doesn’t make a lot of sense to have to wrap it that way – unless the function is being modified elsewhere as well

    When I tested out my code, I did it on a vanilla WP install, no plugins active to be redefining the function… but, oh wells!

Viewing 16 replies (of 16 total)
  • The topic ‘How to Override a Function’ is closed to new replies.