[wp-hackers] register_uninstall_hook VS uninstall.php

scribu scribu at gmail.com
Sat May 8 13:06:47 UTC 2010


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


More information about the wp-hackers mailing list