[wp-hackers] register_uninstall_hook VS uninstall.php

Davit Barbakadze jayarjo at gmail.com
Fri May 7 16:52:02 UTC 2010


Can anyone explain a bit more deeply, what is meant in the paragraph below?
Especially in the part about "The plugin should not run arbitrary code
outside of functions"?

"The plugin should not run arbitrary code outside of functions, when
registering the uninstall hook. In order to run using the hook, the plugin
will have to be included, which means that any code laying outside of a
function will be run during the uninstall process. The plugin should not
hinder the uninstall process. "

http://codex.wordpress.org/Function_Reference/register_uninstall_hook

There is always some code inside the plugin right? register_uninstall_hook
looks more convenient, 'cause for example I use variable in option and table
names, which depend on the classname of the plugin, or for example I want to
use variables form within my plugin to check some conditions before
uninstalling. And by the way can I use array($this, 'callback') type of
callback in register_uninstall_hook?

-- 
Davit Barbakadze


More information about the wp-hackers mailing list