A typical first step of most user-configurable plugins is to create a default set of values for all options when the plugin is activated. These default options will subsequently be used to populate the plugin's settings page when it is visited by the site administrator. This recipe shows how to register a function that is called when a plugin is activated, and how to store option data in the site database.
- Navigate to the WordPress plugin directory of your development installation.
- Create a new directory called
- Navigate to this directory and create a new text file called
- Open the new file in a code editor and add an appropriate header at the top of the plugin file, naming the plugin
Chapter 3 - Individual Options.
- Add the following line of code to register a function that will be executed when the plugin is activated, after its initial installation or following an upgrade...