Opened 15 years ago
Closed 14 years ago
#14149 closed enhancement (wontfix)
Introduce register_settings()
Reported by: | nacin | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | Administration | Keywords: | has-patch |
Focuses: | Cc: |
Description
Introduce register_settings() as a wrapper for register_setting().
Currently, you need to loop on register_setting(), or some try to use the add_option_whitelist function or filters (which was originally introduced partially as a private helper and partially for bulk adds -- http://mu.wordpress.org/forums/topic/7415, #11730). It's ugly. We can make it better.
Untested patch. It takes either array( option, option, option ) or array( option => callback, option => callback ).
Attachments (2)
Change History (7)
#2
in reply to:
↑ 1
@
15 years ago
Replying to blepoxp:
I'll test this momentarily. If this is introduced we probably should introduce an unregister_settings function at the same time.
Yep. Didn't get that far.
#3
@
15 years ago
What do you think about the attached .diff? It would allow for options array to be a mixed index / associative array where indexed == no callback and associative == callback. ie:
$options = array( 'option_one', 'option_two' => 'option_two_callback', 'option_three' );
#4
@
14 years ago
Tempted to wontfix. Bulk adds should be relatively rare as most people are going to use a single option and serialize it.
If someone wants to loop through using an array and foreach, that seems amenable and allows for customization.
Especially with the callback, register_settings() only looks unnecessarily complex. Better for someone to loop themselves.
I'll test this momentarily. If this is introduced we probably should introduce an unregister_settings function at the same time.