[wp-trac] [WordPress Trac] #19315: sanitize_option callback in register_setting()

WordPress Trac wp-trac at lists.automattic.com
Mon Nov 21 13:35:29 UTC 2011


#19315: sanitize_option callback in register_setting()
---------------------------+-----------------------------
 Reporter:  digitalnature  |      Owner:
     Type:  defect (bug)   |     Status:  new
 Priority:  normal         |  Milestone:  Awaiting Review
Component:  Validation     |    Version:  3.2
 Severity:  normal         |   Keywords:
---------------------------+-----------------------------
 This is the user validation function you pass to register setting.

 The problem is that if you're manually updating your option within this
 function, your option won't get updated because update_option() will run
 your callback on $newvalue, which changes it to the old option value. So
 it will do nothing because it would appear that both new and old values
 are identical.

 I know there aren't many situations in which you would want to modify your
 option within that validation callback because that's what that callback
 should do in the first place, but they do exist :)

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/19315>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list