#42925 closed defect (bug) (wontfix)
register_setting backwards compatibility when function defined after registration
Reported by: | ItayXD | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 4.9.1 |
Component: | Options, Meta APIs | Keywords: | |
Focuses: | Cc: |
Description
to make register_setting backward compatible this code is used:
if ( is_callable( $args ) ) { $args = array( 'sanitize_callback' => $args, ); }
so if you call register_setting with a function instead of args, and only then define that function is_callable returns false, and the function is never passed.
Change History (3)
Note: See
TracTickets for help on using
tickets.
Thanks for the report @ItayXD and sorry it's taken so long for you to get a response! What you're asking for is making improvements to what is effectively a deprecated API - and I'm not sure it's even possible with PHP.
You should just use the newer array format for the
$args
parameter to pass your callback instead.