Make WordPress Core

Ticket #35658: 35658.26.diff

File 35658.26.diff, 1.4 KB (added by helen, 8 years ago)
  • src/wp-includes/meta.php

     
    10171017
    10181018        /* translators: object type name */
    10191019        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.' ) );
    10211021        }
    10221022
    10231023        $defaults = array(
     
    10631063
    10641064        // Object subtype is required if using the args style of registration
    10651065        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.' ) );
    10671067        }
    10681068
    10691069        // If `auth_callback` is not provided, fall back to `is_protected_meta()`.
     
    10971097                return true;
    10981098        }
    10991099
    1100         return false;
     1100        return new WP_Error( 'register_meta_failed', __( 'Sanitize and auth callbacks applied; meta not registered.' ) );
    11011101}
    11021102
    11031103/**
     
    11201120
    11211121        // Only specific core object types are supported.
    11221122        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.' ) );
    11241124        }
    11251125
    11261126        if ( ! isset( $wp_meta_keys[ $object_type ] ) ) {