WordPress.org

Make WordPress Core

Ticket #38282: 38282.diff

File 38282.diff, 735 bytes (added by websupporter, 5 years ago)
  • src/wp-trackback.php

     
    112112
    113113        $commentdata = compact('comment_post_ID', 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_content', 'comment_type');
    114114
    115         wp_new_comment($commentdata);
    116         $trackback_id = $wpdb->insert_id;
     115        $trackback_id = wp_new_comment( $commentdata, true );
     116        if ( is_wp_error( $trackback_id ) )  {
     117                trackback_response( 1, $trackback_id->get_error_message() );
     118        }
    117119
     120        if ( ! $trackback_id ) {
     121                trackback_response( 1, __( 'Unknown error occured.' ) );
     122        }
     123
    118124        /**
    119125         * Fires after a trackback is added to a post.
    120126         *