Skip to:
Content
Pages
Categories
Search
Top
Bottom

Settings not saving in admin for new fields added

Viewing 5 replies - 1 through 5 (of 5 total)

  • Robin W
    Moderator

    @robin-w

    I’m a bit of a newbie to this area, having just created my first settings page, so of this is irrelevant, please ignore !

    The following talks about needing to register

    https://codex.wordpress.org/Settings_API

    eg “NOTE: You MUST register any options you use with add_settings_field() or they won’t be saved and updated automatically. ” – which seems to describe your problem

    and

    https://codex.wordpress.org/Function_Reference/register_setting

    That may not be necessary as you’re adding it as a filter??

    anyway my code cribbed from elsewhere looked like

    // register the plugin settings
    function ui_register_settings() {
    
    	// create whitelist of options
    	register_setting( 'ui_settings_group', 'ui_settings' );
    	}
    //call register settings function
    add_action( 'admin_init', 'ui_register_settings' );
    

    where ui_settings was my array.

    Yes this is irrelevant as I am using filters to just add new fields. This is why I don’t understand it not saving correctly.

    The options are saved but the value on each field is given a ZERO instead.

    Is there a filter I missed for when the user saves the settings ?

    If it helps, this is the tutorial I followed as it is the only one I have come across so far.

    May be I overlooked something or there is a spelling mistake. A fresh pair of eyes might do just the trick.


    Robin W
    Moderator

    @robin-w

    I’d download the plugin bbp notify to your pc, and crack that open. That plugin adds stuff to dashboard>settings>forums, so see how that one does it.

    Thank you for the tip. I will check it out. Maybe there is something in there that the tutorial did not have.

    Thank you for your help @robin-w. I have solved the problem and I am now able to complete the plugin.

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.
Skip to toolbar