Make WordPress Core

Ticket #35658: 35658.37.diff

File 35658.37.diff, 1.6 KB (added by jeremyfelt, 8 years ago)
  • src/wp-includes/meta.php

     
    10311031
    10321032        // There used to be individual args for sanitize and auth callbacks
    10331033        $has_old_sanitize_cb = false;
     1034        $has_old_auth_cb = false;
    10341035
    10351036        if ( is_callable( $args ) ) {
    10361037                $args = array(
     
    10441045
    10451046        if ( is_callable( $deprecated ) ) {
    10461047                $args['auth_callback'] = $deprecated;
     1048
     1049                $has_old_auth_cb = true;
    10471050        }
    10481051
    10491052        $args = wp_parse_args( $args, $defaults );
     
    10611064        $args = apply_filters( 'register_meta_args', $args, $defaults, $object_type, $meta_key );
    10621065
    10631066        // Object subtype is required if using the args style of registration
    1064         if ( ! $has_old_sanitize_cb && empty( $args['object_subtype'] ) ) {
     1067        if ( ! $has_old_sanitize_cb && ! $has_old_auth_cb && empty( $args['object_subtype'] ) ) {
    10651068                return new WP_Error( 'register_meta_failed', __( 'Meta must be registered against an object subtype.' ) );
    10661069        }
    10671070
     
    10841087        if ( $has_old_sanitize_cb ) {
    10851088                add_filter( "sanitize_{$object_type}_meta_{$meta_key}", $args['sanitize_callback'], 10, 4 );
    10861089                add_filter( "auth_{$object_type}_meta_{$meta_key}", $args['auth_callback'], 10, 6 );
    1087         } else {
     1090        }
     1091
     1092        if ( $has_old_auth_cb ) {
     1093                add_filter( "auth_{$object_type}_meta_{$meta_key}", $args['auth_callback'], 10, 6 );
     1094        }
     1095
     1096        if ( ! $has_old_auth_cb && ! $has_old_sanitize_cb) {
    10881097                if ( is_callable( $args['sanitize_callback'] ) ) {
    10891098                        add_filter( "sanitize_{$object_type}_{$object_subtype}_meta_{$meta_key}", $args['sanitize_callback'], 10, 4 );
    10901099                }