What happens, when I click Save Changes
on a option page, which was created by add_menu_page()
? Where is the submitted data stored before the database transmission?
A print_r($_REQUEST)
returns only the two $_GET
parameters page
and settings-updated
.
I've checked the manual for add_settings_field
and there is only the following hint:
... the saving will be done behind the scenes.
Background
I'd like to optimize my process of creating a plugin settings page. I've already jumped on the WP Settings API with add_settings_section
and add_settings_field
long time ago, but it feels a bit uncomfortable to create a new callback function every time. So instead of creating the specific field/section code inside a callback, I'd like to create the complete settings page with Zend_View
. All input fields would be created with Zend_Form
and also attached to the view. In the end, the callback of add_menu_page()
will return the rendered View-Object instead of the normal HTML output.
The HTML is stored inside a View-Template, located in views/pages/admin/
(e.g. default.phtml
).
The basic principle is already working I'm very happy with the result. Due to the use of Zend_View
, I've to do the saving on my own. But WordPress seems to delete the submitted $_POST array. If I debug the output after a successfull form submission, only the two $_GET
params above are set.
I've also attached the output of the function settings_fields()
to the view, which generates the required hidden fields (option_page
, action
, _wp_nonce
).
Any ideas?