Processing and storing plugin configuration data
With the configuration page in place, plugin users will be able to modify configuration options and submit them to be stored in the WordPress database. The missing link at this time is the creation of a data processing function that will receive the data posted by the user and store it in the site's options
table.
Getting ready
You should have already followed the Rendering the admin page contents using HTML recipe and the resulting plugin should still be active on your development site. Alternatively, you can get the resulting code (ch3/ch2-page-header-output/ch2-page-header-output-v5.php
) from the book's GitHub page. You should rename the ch2-page-header-output-v5.php
file as ch2-page-header-output.php
before starting this recipe.
How to do it...
Follow these steps to implement a data processing function to validate the plugin's options data and store it in an options array:
- Navigate to the
ch2-page...