Ticket #35658: 35658.37.2.diff
File 35658.37.2.diff, 1.7 KB (added by , 8 years ago) |
---|
-
src/wp-includes/meta.php
1031 1031 1032 1032 // There used to be individual args for sanitize and auth callbacks 1033 1033 $has_old_sanitize_cb = false; 1034 $has_old_auth_cb = false; 1034 1035 1035 1036 if ( is_callable( $args ) ) { 1036 1037 $args = array( … … 1044 1045 1045 1046 if ( is_callable( $deprecated ) ) { 1046 1047 $args['auth_callback'] = $deprecated; 1048 1049 $has_old_auth_cb = true; 1047 1050 } 1048 1051 1049 1052 $args = wp_parse_args( $args, $defaults ); … … 1061 1064 $args = apply_filters( 'register_meta_args', $args, $defaults, $object_type, $meta_key ); 1062 1065 1063 1066 // 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'] ) ) { 1065 1068 return new WP_Error( 'register_meta_failed', __( 'Meta must be registered against an object subtype.' ) ); 1066 1069 } 1067 1070 … … 1084 1087 if ( $has_old_sanitize_cb && is_callable( $args['sanitize_callback'] ) ) { 1085 1088 add_filter( "sanitize_{$object_type}_meta_{$meta_key}", $args['sanitize_callback'], 10, 4 ); 1086 add_filter( "auth_{$object_type}_meta_{$meta_key}", $args['auth_callback'], 10, 6 ); 1087 } else { 1089 } 1090 1091 if ( $has_old_auth_cb && is_callable( $args['auth_callback'] ) ) { 1092 add_filter( "auth_{$object_type}_meta_{$meta_key}", $args['auth_callback'], 10, 6 ); 1093 } 1094 1095 if ( ! $has_old_auth_cb && ! $has_old_sanitize_cb) { 1088 1096 if ( is_callable( $args['sanitize_callback'] ) ) { 1089 1097 add_filter( "sanitize_{$object_type}_{$object_subtype}_meta_{$meta_key}", $args['sanitize_callback'], 10, 4 ); 1090 1098 }