[wp-hackers] register_uninstall_hook VS uninstall.php
Andrew Nacin
wp at andrewnacin.com
Fri May 7 20:24:16 UTC 2010
On Fri, May 7, 2010 at 4:14 PM, Otto <otto at ottodestruct.com> wrote:
> On Fri, May 7, 2010 at 2:08 PM, Davit Barbakadze <jayarjo at gmail.com>
> wrote:
> > Do you find any issue with my solution?
>
> Only that it seems wholly unnecessary.
>
> What exactly is the issue here? Your plugin shouldn't do anything of
> consequence merely from being included. Quite honestly, NO plugin
> should do anything of consequence from merely being included.
>
> Take your "on load" stuff and move it inside a function that's hooked
> to plugins_loaded instead, so it'll run that stuff after the normal
> load process. plugins_loaded doesn't get triggered on the uninstall,
> so you'll be safe there.
I completely agree with Otto. I'm not at all sure what you're trying to do,
but I'm sure you can do it without reinventing the wheel 10 times over.
This is honestly why plugins break on new versions of WP -- it's often not
that they do something that the API doesn't provide for, it's that they do
something the API *does *provide for, but *don't* use the API, and that's
what breaks.
You don't need WP_UNINSTALL_PLUGIN to check if you're being uninstalled.
When your uninstall hook is fired, you'll know you're being uninstalled.
Clean up your data so WP can delete you.
More information about the wp-hackers
mailing list