[wp-testers] Add Option and uninstall
due chiacchiere
info at duechiacchiere.it
Wed Mar 24 18:17:49 UTC 2010
Hi all,
I'm working on a plugin which needs to store some data in the table
"wp_options", and to create some new tables as well. I have two questions:
1) Why calling add_option('myoption', array(), 'no') creates a new entry
that has the 'autoload' field set to YES in the database? Am I doing
something wrong?
2) Since I want to be a 'good developer', I added the uninstall function
to be executed whenever the user decides to remove this plugin from his
WP box. So I have this method inside my class:
public function uninstall() {
global $wpdb;
// Goodbye data...
$wpdb->query("DROP TABLE IF EXISTS `tablename`");
// Goodbye options...
delete_option('myoption');
}
And then it's hooked like this
register_uninstall_hook( __FILE__, array( &$myclass, 'uninstall' ) );
I've tried both with 2.9 and 3.0alpha, and the table is still there
after I uninstall the plugin via the admin interface.
Thanks for your time,
dino.
More information about the wp-testers
mailing list