1466 posts
  • Has been a member for 2-3 years
  • Exclusive Author
  • Sold between 10 000 and 50 000 dollars
  • Bought between 10 and 49 items
  • Referred between 1 and 9 users
  • Croatia
OriginalEXE says

Hey WP developers, I am wondering:

Should I delete data like options and custom posts ( using custom post types ) on plugin uninstall?

I know it’s good practice to do so, but the issue is that I don’t have automatic update with my plugins, and some users don’t know how to use FTP, so the only way for them to update the plugin is to uninstall and delete the current one, and then install new version.

How should I approach this?

326 posts
  • Sold between 10 000 and 50 000 dollars
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Referred between 100 and 199 users
  • Bought between 50 and 99 items
  • Has been a member for 3-4 years
  • Envato Studio (Microlancer) Beta Tester
  • Exclusive Author
  • Portugal
vtimbuc says

I’m not a WP Developer, but I think that the best solution is to add a check-box, that is unchecked by default and if the user checks it then delete the data on uninstall. (not sure if this is possible)

1466 posts
  • Has been a member for 2-3 years
  • Exclusive Author
  • Sold between 10 000 and 50 000 dollars
  • Bought between 10 and 49 items
  • Referred between 1 and 9 users
  • Croatia
OriginalEXE says

I’m not a WP Developer, but I think that the best solution is to add a check-box, that is unchecked by default and if the user checks it then delete the data on uninstall. (not sure if this is possible)

That is actually good idea, and yes, it is possible :) I believe I’ll go that way, thanks!

40 posts
  • Envato Studio (Microlancer) Beta Tester
  • Exclusive Author
  • Has been a member for 2-3 years
  • Referred between 1 and 9 users
  • Bought between 1 and 9 items
orbitalplugins says

I’m not a WP Developer, but I think that the best solution is to add a check-box, that is unchecked by default and if the user checks it then delete the data on uninstall. (not sure if this is possible)

This is the way to do it, definitely do not delete the data without warning though.

35 posts
  • Sold between 10 000 and 50 000 dollars
  • Referred between 1 and 9 users
  • United Kingdom
  • Exclusive Author
  • Has been a member for 4-5 years
  • Bought between 10 and 49 items
2DMonkey says

I’m not a WP Developer, but I think that the best solution is to add a check-box, that is unchecked by default and if the user checks it then delete the data on uninstall. (not sure if this is possible)

Agree – you should definitely not delete data on plugin deactivation/uninstall. It’s best to leave data as it is so that when you release an update it’s easy for your customers to replace the plugin files and re-activate. We have a separate function that wipes the plugin data – this has to be clicked and then confirmed by the user.

1466 posts
  • Has been a member for 2-3 years
  • Exclusive Author
  • Sold between 10 000 and 50 000 dollars
  • Bought between 10 and 49 items
  • Referred between 1 and 9 users
  • Croatia
OriginalEXE says

Thanks guys! I went with that solution – checkbox in plugin options and implemented check in uninstall.php

5 posts
  • Has been a member for 1-2 years
chamath says

adding a check box is a good idea! saved me a lot of troubles. you know sometimes you forget the simplest things

by
by
by
by
by
by