Learn how to use three fundamental WordPress hooks to add custom functionality when a plugin is activated, deactivated, or uninstalled. These hooks give you granular control, enable you to make sure that plugins are set up correctly, and ensure they clean up after themselves when they are removed.
- [Narrator] As explained in the previous tutorial,…hooks play a key role in plugin development.…In this video, we'll look at three important hooks…that we can use when creating our own WordPress plugins.…These three hooks enable us to customize functionality…when the plugin is activated, deactivated, or uninstalled.…To better understand how these hooks work,…let's look at some examples.…First, we have the register_activation_hook.…The activation hook runs when the plugin is activated…from the plugins page in the admin area.…
It is a useful hook for doing things…like adding default options,…creating database tables,…checking configuration,…and anything else that needs doing…when the plugin is activated.…To see how it works,…let's create a function that adds a couple of options…to the options table.…Here we have the plugin demo for this video…installed in the WordPress plugins directory.…The first function is registered with the activation hook…so it will execute when the plugin is activated.…
The first parameter here is a PHP constant…
- WordPress APIs
- Action and filter hooks
- Activating and deactivating plugins
- Plugin security
- Creating the directory and files
- Adding menus and the settings page
- Inserting custom functionality
- Testing and debugging WordPress plugins
- Creating widgets
- Managing users and roles
- Adding custom post types and taxonomies
- Working with custom fields and database queries
- Using APIs: Transients, HTTP, and REST
Skill Level Intermediate
WordPress: Developing Secure Siteswith Jeff Starr2h 34m Intermediate
1. First Steps
2. Plugin Basics
3. Building a WordPress Plugin
4. Essential Plugin Techniques
5. Extending Plugin Functionality
6. Advanced Plugin Techniques
Next steps1m 16s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.