diff --git src/wp-admin/includes/media.php src/wp-admin/includes/media.php
index d9dd1e6..5b04b7c0 100644
--- src/wp-admin/includes/media.php
+++ src/wp-admin/includes/media.php
@@ -121,11 +121,7 @@ function get_image_send_to_editor( $id, $caption, $title, $align, $url = '', $re
 
 	$html = get_image_tag($id, $alt, '', $align, $size);
 
-	if ( ! $rel ) {
-		$rel = ' rel="attachment wp-att-' . esc_attr( $id ) . '"';
-	} else {
-		$rel = ' rel="' . esc_attr( $rel ) . '"';
-	}
+	$rel = $rel ? ' rel="' . esc_attr( $rel ) . '"' :  '';
 
 	if ( $url )
 		$html = '<a href="' . esc_attr($url) . "\"$rel>$html</a>";
@@ -1166,7 +1162,10 @@ function image_media_send_to_editor($html, $attachment_id, $attachment) {
 		$align = !empty($attachment['align']) ? $attachment['align'] : 'none';
 		$size = !empty($attachment['image-size']) ? $attachment['image-size'] : 'medium';
 		$alt = !empty($attachment['image_alt']) ? $attachment['image_alt'] : '';
-		$rel = ( $url == get_attachment_link($attachment_id) );
+		$rel = '';
+		if ( strpos( $url, 'attachment_id') || $url == get_attachment_link($attachment_id) ) {
+			$rel = 'attachment wp-att-' . $id;
+		}
 
 		return get_image_send_to_editor($attachment_id, $attachment['post_excerpt'], $attachment['post_title'], $align, $url, $rel, $size, $alt);
 	}
