Data on options page not stored on first save
-
I have written an options page for my plugin. The page stores three settings for the plugin: 1. Application title, 2. App Id, and 3. App Password Hash. These are used to authenticate with a third party app. The problem is when a user installs the plugin and saves the data for the first time. The title and id are stored correctly but the password hash is not saved. On the second time the password hash is stored correctly. What can I be doing wrong here? Why is the data being skipped the first time, but saved the second time? Any help would be appreciated.
Here are my fields:
function plugin_admin_init(){ register_setting( 'plugin_options', 'plugin_options', 'plugin_options_validate' ); add_settings_section('plugin_main', 'Main Settings', 'plugin_section_text', 'plugin'); add_settings_field('plugin_app_title', 'Title', 'plugin_setting_app_title', 'plugin', 'plugin_main'); add_settings_field('plugin_app_id', 'Application Id', 'plugin_setting_app_id', 'plugin', 'plugin_main'); add_settings_field('plugin_app_password', 'Password Hash', 'plugin_setting_app_password', 'plugin', 'plugin_main'); add_settings_field('plugin_app_password2', 'Confirm Password Hash', 'plugin_setting_app_password2', 'plugin', 'plugin_main'); }
- The topic ‘Data on options page not stored on first save’ is closed to new replies.