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

WordPress Trac noreply at wordpress.org
Thu Feb 1 23:51:43 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:
-----------------------------------+------------------------------
Changes (by flixos90):

 * keywords:  needs-patch 2nd-opinion => 2nd-opinion has-patch


Comment:

 [attachment:43208.diff] introduces the `validate_option_{$option}` filter
 as a possible implementation. Note that it is only fired if previous core
 validation didn't already produce an error. This allows for full backward-
 compatibility, allows performing additional validation even on core
 values, while preventing plugins from removing errors detected by core.

 For easy handling of setting validation, a `$validate_callback` argument
 has been introduced for `register_setting()` which is then hooked into the
 filter.

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


More information about the wp-trac mailing list