How can i delete options on plugin uninstallation?

I want to delete option from database when plugin uninstall. It’s name is test_option. I am using this code but doesn’t work. Where is problem?

function test_delete() {
if( !current_user_can( ‘activate_plugins’ ) )
return;
check_admin_referer( ‘bulk-plugins’ );

if( __FILE__ != WP_UNINSTALL_PLUGIN )
return;

delete_option( ‘test_option’ );
}

register_uninstall_hook( __FILE__, ‘test_delete’ );

Read more here:: How can i delete options on plugin uninstallation?

Leave a Reply

Your email address will not be published. Required fields are marked *