Why aren’t these WordPress options being saved to the database correctly?

The options are not being saved correctly because you used the wrong input name — it should match the second parameter for register_setting(). So for example, with register_setting(‘myplugin_options_group’, ‘api_username’), the input name should be api_username, but then you used myplugin_api_username. Additionally, it should be noted that screen_icon() has long been deprecated.

Plugin Options not being output

Basically, you’re not using the correct option name. In your viptips_settings_init() function, you use the name viptips_settings as the database option name when registering the setting: // The syntax is: register_setting( ‘<settings group name>’, ‘<database option name>’ ) register_setting( ‘pluginPage’, ‘viptips_settings’ ); So WordPress will use that viptips_settings when saving the option (i.e. update_option( ‘viptips_settings’, … Read more

Error: options page not found when I try to save the changes made in my settings page

The problem is in my file settings.php (which renders the form). Look at the form action. It says action=”options.php” and then the settings_field() inserts a hidden field with the correct action. But WordPress prioritizes the form action, so, when submit the form, WordPress tries to load options.php instead of the correct action in the hidden … Read more

Serialize data for wp options

To store Data use this Code : save the serialize values $title=”Your Title Value”; $message=”Your message HTML..”; $image=”http://www.domain.com/yourimage.jpg”; $notice_data = array(‘title’ => $title, ‘message’ => $message, ‘image’ => $image ); if(get_option(‘notice_data’) === FALSE){ add_option(‘notice_data’, $notice_data ); }else{ update_option(‘notice_data’, $notice_data ); } Now you can get the serialize values and use in your code $notice_data = … Read more

WordPress setting with select – where is my mistake?

The problem is that in your calls to selected() you haven’t set the 3rd parameter to false. For both selected() and checked() if you don’t do this it will echo the attribute immediately, which won’t work properly if you’re using it inside a concatenated string. So change: selected( get_option(‘myplugin_admin_bar’), 1 ) To: selected( get_option(‘myplugin_admin_bar’), 1, … Read more