Quantcast
Viewing all articles
Browse latest Browse all 8245

djeyewater on "Confused about WP_UNINSTALL_PLUGIN and uninstall hook"

Ref. http://codex.wordpress.org/Function_Reference/register_uninstall_hook
and http://wordpress.stackexchange.com/questions/25910/uninstall-a-plugin-method-typical-features-how-to/25979#25979/

In an uninstall hook callback you should check whether WP_UNINSTALL_PLUGIN is defined. However I am having trouble when the function called by the uninstall hook is not in the main plugin file.

If I pass the main plugin file as the $file parameter to register_uninstall_hook, then WP_UNINSTALL_PLUGIN is always undefined when the callback is called. (According to the docs it should be defined).

I've also tried passing the file containing the callback function as the $file parameter, but then the callback is not called at all.

I've uploaded my Test plugin here: http://www.iliveinabin.com/test.tar.gz
Or you can see the contents of the files here:
Main plugin file: http://pastebin.com/m4wMFXJM
Test.class.php: http://pastebin.com/ZYmtuDEZ

I'm activating / deactivating / deleting as an admin on a multisite installation if that makes any difference.

Thanks

Dave


Viewing all articles
Browse latest Browse all 8245

Trending Articles