Ticket #35658: 35658.37.diff
File 35658.37.diff, 1.6 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 ) { 1085 1088 add_filter( "sanitize_{$object_type}_meta_{$meta_key}", $args['sanitize_callback'], 10, 4 ); 1086 1089 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) { 1088 1097 if ( is_callable( $args['sanitize_callback'] ) ) { 1089 1098 add_filter( "sanitize_{$object_type}_{$object_subtype}_meta_{$meta_key}", $args['sanitize_callback'], 10, 4 ); 1090 1099 }