WordPress.org

Make WordPress Core

Opened 7 years ago

Closed 7 years ago

#29193 closed enhancement (duplicate)

Settings sanitize callback - $option arg is not available

Reported by: dashaluna Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.0
Component: Options, Meta APIs Keywords: has-patch
Focuses: Cc:

Description (last modified by SergeyBiryukov)

If you register a setting and specify a sanitize callback, the option name argument is not available in the callback function.

See wp-includes/formatting.php line 3432 - where WordPress applys the santiization filters.

    $value = apply_filters( "sanitize_option_{$option}", $value, $option );

It passes as second arg of $option, but when registering as setting - the sanitization callback is added to this filter, but the number of accepted args is not specified when adding the filter.

Attachments (1)

29193.diff (538 bytes) - added by dashaluna 7 years ago.

Download all attachments as: .zip

Change History (4)

@dashaluna
7 years ago

#1 @dashaluna
7 years ago

  • Keywords has-patch added

#2 @mattheu
7 years ago

It turns out that this has been removed intentionally to maintain backwards compatability - see #18914

Last edited 7 years ago by SergeyBiryukov (previous) (diff)

#3 @SergeyBiryukov
7 years ago

  • Component changed from General to Options, Meta APIs
  • Description modified (diff)
  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Duplicate of #15335.

Note: See TracTickets for help on using tickets.