diff options
| author | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2005-12-01 15:28:34 +0000 |
|---|---|---|
| committer | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2005-12-01 15:28:34 +0000 |
| commit | ca460de5458e35b012e643b2af4880312c06d0f6 (patch) | |
| tree | ebe8e430f2a863ae7b6671ea3e51ff1eaee0bb7a /wp-inst/wp-admin/admin-functions.php | |
| parent | 814b39931c8ff188122ba77b78388b4fbe7008df (diff) | |
| download | wordpress-mu-ca460de5458e35b012e643b2af4880312c06d0f6.tar.gz wordpress-mu-ca460de5458e35b012e643b2af4880312c06d0f6.tar.xz wordpress-mu-ca460de5458e35b012e643b2af4880312c06d0f6.zip | |
WP Merge
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@454 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-inst/wp-admin/admin-functions.php')
| -rw-r--r-- | wp-inst/wp-admin/admin-functions.php | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/wp-inst/wp-admin/admin-functions.php b/wp-inst/wp-admin/admin-functions.php index cfce700..d89f5b1 100644 --- a/wp-inst/wp-admin/admin-functions.php +++ b/wp-inst/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; |
