-
Notifications
You must be signed in to change notification settings - Fork 94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Activation/Deactivation methods #2698
Comments
Lesson Development Checklist
|
@jonathanbossenger I think training developers to use the activation and deactivation hooks for adding and removing data is quite risky for our ecosystem since my understanding is that is not the intended user experience in wp-admin. I think your code example is more appropriate in discussion of the uninstallation hook since that is typically when plugin data should actually be removed. I believe the Cron lesson comes later in the course, but my understanding is the activation and deactivation hooks are best used for adding and cleaning up side-effects, similar to Is there a more appropriate code sample that could be provided for this lesson? |
@MichelleBlanchette, thanks for your feedback; you do raise a valid point. In this specific code example, it could be argued that the addition of the option in the database is a side effect of activating the plugin, and so, depending on the plugin's specific requirements, removing that option on deactivation could make sense. The other problem is, this plugin is not something someone might build in the real world. One of the main reasons I went with a very simplified code example in this lesson is that it's easy to test that the deactivation code has worked. The learner can check the table and see that the option has been removed. That's always the problem with example code: It's generally not a real-world solution with all the considerations that go with it. One thing I had planned on doing was including a section in the Uninstall Methods lesson, which is right after this one, on when it's generally recommended to use deactivation vs. uninstallation. So perhaps a short section at the end of this lesson covering these considerations would help? This can also be used to direct learners to the next lesson, which could then also cover these considerations further. |
@jonathanbossenger I like the idea of leaving a little cliffhanger at the end, like you're kind of saying, that encourages moving on to the next lesson about uninstallation. I think that could work. Thanks! |
Great. I'll work on getting the script updated. |
Added section on Plugin deactivation and data cleanup |
Looks great @jonathanbossenger ~ Thank you for that! |
Details
Prerequisites
It is assumed that the learner has already completed the following lessons:
Learning Objectives
Related Resources and Other Notes
Automation Code
//lesson
The text was updated successfully, but these errors were encountered: