[wp-hackers] register_uninstall_hook VS uninstall.php

Davit Barbakadze jayarjo at gmail.com
Sat May 8 13:23:57 UTC 2010


Ah, I see now :) Very clean indeed, I think it should go into the core.
Along with WP_UNINSTALL_PLUGIN both for uninstall.php and
register_uninstall_hook. It won't harm to have a solid way to check what's
happening.

On Sat, May 8, 2010 at 5:06 PM, scribu <scribu at gmail.com> wrote:

> On Sat, May 8, 2010 at 10:20 AM, Davit Barbakadze <jayarjo at gmail.com>
> wrote:
>
> > > Try this:
> > >
> > > // Have more than one callback attached to the uninstall hook
> > > function add_uninstall_hook($plugin, $callback) {
> > >        // trigger $is_uninstallable_plugin flag
> > >        register_uninstall_hook($plugin, '__return_false');
> > >
> > >        add_action('uninstall_' . plugin_basename($plugin), $callback);
> > > }
> > >
> > >
> > > You use it exactly like register_activation_hook().
> > >
> >
> >
> > Looks very nice. But I don't quite understand how this may work... ? It
> > won't work with 2.9.2, right? Is it something from next version? What is
> > going to change?
> >
>
> It will work with 2.9.2 as long as you also add this:
>
> // WP < 3.0
> if ( ! function_exists('__return_false') ) :
> function __return_false() {
>    return false;
> }
> endif;
>
>
>
> --
> http://scribu.net
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>



-- 
Davit Barbakadze


More information about the wp-hackers mailing list