Quantcast
Channel: Topic Tag: plugin | WordPress.org
Viewing all articles
Browse latest Browse all 26892

Mark / t31os on "Submit button not saving settings"

$
0
0

The issue with your original code(which was more inline with correctly using the settings api) is that your inputs all have the same name, they should be named inline with the registered setting 7dayschedule-settings, then differ only in their key.

Here's a trimmed version of your code with the appropriate changes(kept it short and unsanitized to make it easy to follow).
http://pastebin.mozilla.org/2387231

If you want to refine the input printing to make it easier to manage and not require a seperate function for each field(again kept it short and unsanitized to make it easy to follow), simply pass along some args and use a single callback function, like so..
http://pastebin.mozilla.org/2387282

Follow the method i've used in either of the above pastes and your code should operate just fine.

Though it should be noted that register_setting should always be used with your own custom callback that iterates over the options and sanitizes them appropriately.

Hope that helps.


Viewing all articles
Browse latest Browse all 26892

Trending Articles