What is the WordPress plugin uninstall best practice and what is wrong with using `register_deactivation_hook()` for data cleanup?

WordPress Fundamental Hard

WordPress Fundamental — Hard

What is the WordPress plugin uninstall best practice and what is wrong with using `register_deactivation_hook()` for data cleanup?

Key points

  • Deactivation hook is temporary, uninstall hook is permanent cleanup
  • Users may deactivate to troubleshoot, risking data loss
  • Uninstall hook or uninstall.php file gives users control over data deletion

Ready to go further?

Related questions