[wp-hackers] register_uninstall_hook VS uninstall.php

Azizur Rahman prodevstudio+wordpress at gmail.com
Fri May 7 17:20:18 UTC 2010


>
> As Dion said, you cannot use a class method for a callback for an uninstall
> hook. You also cannot use multiple uninstall callbacks. If you need a more
> complex uninstall process, use uninstall.php. Make sure you check for
> defined( 'WP_UNINSTALL_PLUGIN' ) before continuing (die if it is not
> defined) when using the uninstall.php file.
>


Like the uninstall.php to uninstall, can we use install.php or
activation.php for activation process?


Kind Regards,
Azizur Rahman


On Fri, May 7, 2010 at 6:01 PM, Andrew Nacin <wp at andrewnacin.com> wrote:

> Arbitrary code is referring to code that is not wrapped inside a function,
> with the exception of course of add_action and add_filter calls (and
> _ref_array) tying those functions to hooks. (And hook registrations for
> activation, deactivation, uninstall, etc.)
>
> Generally speaking, a plugin should never do anything before the init hook.
> That includes the enqueue of scripts and styles, the registration of custom
> post types and taxonomies, and so much else.
>
> Since the plugin file needs to be included to execute the uninstall
> function, that code would run here. You don't want that.
>
> As Dion said, you cannot use a class method for a callback for an uninstall
> hook. You also cannot use multiple uninstall callbacks. If you need a more
> complex uninstall process, use uninstall.php. Make sure you check for
> defined( 'WP_UNINSTALL_PLUGIN' ) before continuing (die if it is not
> defined) when using the uninstall.php file.
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>


More information about the wp-hackers mailing list