Make WordPress Core


Ignore:
Timestamp:
11/30/2005 10:44:00 PM (21 years ago)
Author:
ryan
Message:

Attachment cleanups from skeltoac.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/admin-functions.php

    r3224 r3251  
    9898
    9999                $id = $id_matches[2];
     100
     101                // While we have the attachment ID, let's adopt any orphans.
     102                $attachment = & get_post($id);
     103                if ( ! is_object(get_post($attachment->post_parent)) ) {
     104                        $attachment->post_parent = $post_ID;
     105                        wp_update_post($attachment);
     106                }
     107
    100108                $post_search[$i] = $anchor;
    101109                $post_replace[$i] = preg_replace("#href=(\"|')[^'\"]*\\1#e", "stripslashes('href=\\1').get_attachment_link($id).stripslashes('\\1')", $anchor);
Note: See TracChangeset for help on using the changeset viewer.