While the previous recipe worked quite well in creating entries in the site's options table for each individual plugin option, another way to manage user settings is to store them as arrays in the database.
This recipe creates the same option as the previous one, but also adds a second option and uses an array instead of individual options to store them. It also incorporates an upgrade strategy to deal with the creation of additional options as a plugin evolves over time.
You should have already followed the recipe entitled Inserting link statistics tracking code in page body using plugin filters in Chapter 2, Plugin Framework Basics, to have a starting point for this recipe. Alternatively, you can get the resulting code (Chapter 2/ch2-page-header-output/ch2-page-header-output-v2.php
) from the code bundle downloaded from the Packt website (https://www.packtpub.com/support) and rename the file ch2-page-header-output.php
.