[wp-trac] [WordPress Trac] #41810: Add the sanitization function for checkboxes

WordPress Trac noreply at wordpress.org
Wed Sep 6 20:25:59 UTC 2017


#41810: Add the sanitization function for checkboxes
-------------------------------------------------+-------------------------
 Reporter:  Mirucon                              |       Owner:
     Type:  feature request                      |      Status:  new
 Priority:  normal                               |   Milestone:  Awaiting
Component:  Options, Meta APIs                   |  Review
 Severity:  normal                               |     Version:  trunk
 Keywords:  has-patch needs-testing 2nd-opinion  |  Resolution:
                                                 |     Focuses:
-------------------------------------------------+-------------------------

Comment (by Mirucon):

 I've seen several sanitization functions for checkboxes, but they are
 returning only true or false.

 https://github.com/WPTRT/code-examples/blob/master/customizer
 /sanitization-callbacks.php#L12

 https://divpusher.com/blog/wordpress-customizer-sanitization-
 examples#check

 I personally think checkboxes do not need to have custom values and they
 should only be true or false, since they are usually used for switching
 something, like switch to whether displaying tagline or not.

 For the radio boxes / select options, we should have like this function,
 so that only the given choices can be used. https://github.com/WPTRT/code-
 examples/blob/master/customizer/sanitization-callbacks.php#L262

--
Ticket URL: <https://core.trac.wordpress.org/ticket/41810#comment:10>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list