[wp-trac] [WordPress Trac] #43208: Separate setting validation from sanitization

WordPress Trac noreply at wordpress.org
Thu Feb 1 23:54:01 UTC 2018


#43208: Separate setting validation from sanitization
-----------------------------------+------------------------------
 Reporter:  flixos90               |       Owner:
     Type:  enhancement            |      Status:  new
 Priority:  normal                 |   Milestone:  Awaiting Review
Component:  Options, Meta APIs     |     Version:
 Severity:  normal                 |  Resolution:
 Keywords:  2nd-opinion has-patch  |     Focuses:
-----------------------------------+------------------------------

Comment (by flixos90):

 An alternative approach: Introduce an entirely new function
 `validate_option()` and do all validation including the filter in there.
 This function would then be called inside of `add_option()` and
 `update_option()` (''before'' `sanitize_option()`), and if an error is
 returned, make the function not change the value set and return false.
 This actually seems like a cleaner approach to me, but also like a bigger
 change. Let's discuss further.

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


More information about the wp-trac mailing list