Sorry, no attachments matched your criteria.
+ + + +diff --git a/wp-admin/admin-functions.php b/wp-admin/admin-functions.php
index a5291f1e8e..db37780575 100644
--- a/wp-admin/admin-functions.php
+++ b/wp-admin/admin-functions.php
@@ -97,6 +97,14 @@ function fix_attachment_links($post_ID) {
continue;
$id = $id_matches[2];
+
+ // While we have the attachment ID, let's adopt any orphans.
+ $attachment = & get_post($id);
+ if ( ! is_object(get_post($attachment->post_parent)) ) {
+ $attachment->post_parent = $post_ID;
+ wp_update_post($attachment);
+ }
+
$post_search[$i] = $anchor;
$post_replace[$i] = preg_replace("#href=(\"|')[^'\"]*\\1#e", "stripslashes('href=\\1').get_attachment_link($id).stripslashes('\\1')", $anchor);
++$i;
diff --git a/wp-admin/inline-uploading.php b/wp-admin/inline-uploading.php
index 680ec88712..682797f829 100644
--- a/wp-admin/inline-uploading.php
+++ b/wp-admin/inline-uploading.php
@@ -158,6 +158,7 @@ if ( count($attachments) > 0 ) {
$__not_linked = __('Not Linked');
$__linked_to_page = __('Linked to Page');
$__linked_to_image = __('Linked to Image');
+ $__linked_to_file = __('Linked to File');
$__using_thumbnail = __('Using Thumbnail');
$__using_original = __('Using Original');
$__no_thumbnail = __('No Thumbnail');
@@ -167,11 +168,13 @@ if ( count($attachments) > 0 ) {
$script .= "notlinked = '$__not_linked';
linkedtoimage = '$__linked_to_image';
linkedtopage = '$__linked_to_page';
+linkedtofile = '$__linked_to_file';
usingthumbnail = '$__using_thumbnail';
usingoriginal = '$__using_original';
";
foreach ( $attachments as $key => $attachment ) {
$ID = $attachment['ID'];
+ $href = get_attachment_link($ID);
$meta = get_post_meta($ID, '_wp_attachment_metadata', true);
if (!is_array($meta)) {
$meta = get_post_meta($ID, 'imagedata', true); // Try 1.6 Alpha meta key
@@ -204,7 +207,6 @@ src{$ID}b = '{$image['guid']}';
$xpadding = (128 - $image['uwidth']) / 2;
$ypadding = (96 - $image['uheight']) / 2;
$style .= "#target{$ID} img { padding: {$ypadding}px {$xpadding}px; }\n";
- $href = get_attachment_link($ID);
$script .= "a{$ID}a = '';
a{$ID}b = '';
img{$ID}a = '';
@@ -222,9 +224,13 @@ img{$ID}b = '
";
} else {
+ $script .= "a{$ID}a = '{$attachment['post_title']}';
+a{$ID}b = '{$attachment['post_title']}';
+";
$html .= "
Sorry, no attachments matched your criteria.
+ + + +