Make WordPress Core

Opened 5 years ago

Closed 3 years ago

Last modified 3 years ago

#42925 closed defect (bug) (wontfix)

register_setting backwards compatibility when function defined after registration

Reported by: itayxd's profile ItayXD Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.9.1
Component: Options, Meta APIs Keywords:
Focuses: Cc:


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)

This ticket was mentioned in Slack in #core by noisysocks. View the logs.

3 years ago

#2 @markparnell
3 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to wontfix
  • Status changed from new to closed

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.

#3 @SergeyBiryukov
3 years ago

  • Component changed from General to Options, Meta APIs
Note: See TracTickets for help on using tickets.