Make WordPress Core

Opened 10 years ago

Closed 10 years ago

#29193 closed enhancement (duplicate)

Settings sanitize callback - $option arg is not available

Reported by: dashaluna's profile 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 10 years ago.

Download all attachments as: .zip

Change History (4)

@dashaluna
10 years ago

#1 @dashaluna
10 years ago

  • Keywords has-patch added

#2 @mattheu
10 years ago

It turns out that this has been removed intentionally to maintain backwards compatability - see https://core.trac.wordpress.org/ticket/18914

Version 0, edited 10 years ago by mattheu (next)

#3 @SergeyBiryukov
10 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.