Ticket #35658: 35658.26.diff
File 35658.26.diff, 1.4 KB (added by , 8 years ago) |
---|
-
src/wp-includes/meta.php
1017 1017 1018 1018 /* translators: object type name */ 1019 1019 if ( ! in_array( $object_type, array( 'post', 'comment', 'user', 'term' ) ) ) { 1020 _doing_it_wrong( __FUNCTION__, sprintf( __( 'Invalid object type: %s.' ), $object_type ), '4.6.0');1020 return new WP_Error( 'register_meta_failed', __( 'Meta can only be registered against a core object type.' ) ); 1021 1021 } 1022 1022 1023 1023 $defaults = array( … … 1063 1063 1064 1064 // Object subtype is required if using the args style of registration 1065 1065 if ( ! $has_old_sanitize_cb && empty( $args['object_subtype'] ) ) { 1066 return false;1066 return new WP_Error( 'register_meta_failed', __( 'Meta must be registered against an object subtype.' ) ); 1067 1067 } 1068 1068 1069 1069 // If `auth_callback` is not provided, fall back to `is_protected_meta()`. … … 1097 1097 return true; 1098 1098 } 1099 1099 1100 return false;1100 return new WP_Error( 'register_meta_failed', __( 'Sanitize and auth callbacks applied; meta not registered.' ) ); 1101 1101 } 1102 1102 1103 1103 /** … … 1120 1120 1121 1121 // Only specific core object types are supported. 1122 1122 if ( ! in_array( $object_type, array( 'post', 'comment', 'user', 'term' ) ) ) { 1123 return false;1123 return new WP_Error( 'invalid_meta_key', __( 'Invalid meta key. Not a core object type.' ) ); 1124 1124 } 1125 1125 1126 1126 if ( ! isset( $wp_meta_keys[ $object_type ] ) ) {