[wp-trac] [WordPress Trac] #61631: sanitize_option_{$option} inconsistencies
WordPress Trac
noreply at wordpress.org
Thu Jul 11 13:20:01 UTC 2024
#61631: sanitize_option_{$option} inconsistencies
--------------------------------+------------------------------
Reporter: liedekef | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Options, Meta APIs | Version: 6.5.5
Severity: normal | Resolution:
Keywords: | Focuses:
--------------------------------+------------------------------
Comment (by roytanck):
`add_filter`'s third and fourth argument are optional, and default to 10
and 1 respectively. So if your sanitize function only requires the value
to be sanitized, it's completely valid to leave them out. In this case,
the hooked function is called with a single argument, the value of the
option that needs to be sanitized.
In the case of this example (1) the contact email address can probably be
sanitized without the info in the second and third argument.
It seems to me like `register_setting` (2) uses a number of factors to
determine whether the sanitize callback needs one or more arguments, and
calls `add_filter` accordingly. This looks correct to me. Please note that
`register_setting` is not adding a filter (which would be done using
`apply_filters`) but instead uses the existing filter.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/61631#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list