WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Issue with passing settings values (possibly register_settings() related?) (2 posts)

  1. Doodlebee
    Member
    Posted 1 year ago #

    Hey all,

    I was wondering if someone could help me here. I'm trying to update my plugin, and i've added a settings page (nothing that the plugin has ever had before). I used Otto' tutorial on adding a settings page, and it's worked a treat.

    However...

    I found the need to add a new filed to my settings page, but when I added it, it will not save.

    The code is here, if you'd like to take a look.

    Now, under the bei_options_validate() function, I've added print_r($input) to see what's being passed when I submit the form, and it returns Array ( [admin] => activate_plugins [public] => no [registered] => yes ) every time. It SHOULD be retuning Array ( [admin] => activate_plugins [public] => no [registered] => yes [view] => selected_value ) - which makes me think that my new field has not been registered. but it makes no sense, because (as you can see in the code) it's there.

    And yes, I have the plugin set to add_option (so it can be registered) with all the proper keys, with default values.

    I'm thinking it's either the fact that it's a new settings field in an old options setting (but I've been completely removing the options every time I want to test - the option is gone, but upon activation, it's put back in fresh and clean - it's just when I save the form, it seems to remove "view" field...

    OR

    I've got my dropdown set to pass field incorrectly. All the other fields are radio buttons. it seems to pass an empty value every time. So it's possible I have the dropdowns set up wrong and it's not passing the value.

    I'm honestly hoping it's the latter issue, because I think that'll be easier to fix!

    Anyway, if anyone's got an extra pair of eyes that you can run over this code and see what I'm doing wrong, I'd appreciate it.

  2. Doodlebee
    Member
    Posted 1 year ago #

    GAH! I found it.

    it was on line 87 of the code:

    echo '<p><select id="bei_view" name="name="bei_options[view]"></p>' . "\n";

    darn copy/paste. I have "name" in there twice... it should look like:

    echo '<p><select id="bei_view" name="bei_options[view]"></p>' . "\n";

    I feel smart for the day! Thanks anyway, all :)

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.