Changeset 3586 for trunk/wp-admin/admin-functions.php
- Timestamp:
- 03/02/2006 02:47:36 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/admin-functions.php
r3570 r3586 106 106 global $wp_rewrite; 107 107 108 $post = & get_post($post_ID );108 $post = & get_post($post_ID, ARRAY_A); 109 109 110 110 $search = "#<a[^>]+rel=('|\")[^'\"]*attachment[^>]*>#ie"; 111 111 112 112 // See if we have any rel="attachment" links 113 if ( 0 == preg_match_all($search, $post ->post_content, $anchor_matches, PREG_PATTERN_ORDER) )113 if ( 0 == preg_match_all($search, $post['post_content'], $anchor_matches, PREG_PATTERN_ORDER) ) 114 114 return; 115 115 … … 123 123 124 124 // While we have the attachment ID, let's adopt any orphans. 125 $attachment = & get_post($id); 126 if ( ! is_object(get_post($attachment->post_parent)) ) { 127 $attachment->post_parent = $post_ID; 125 $attachment = & get_post($id, ARRAY_A); 126 if ( ! empty($attachment) && ! is_object(get_post($attachment['post_parent'])) ) { 127 $attachment['post_parent'] = $post_ID; 128 // Escape data pulled from DB. 129 $attachment = add_magic_quotes($attachment); 128 130 wp_update_post($attachment); 129 131 } … … 134 136 } 135 137 136 $post->post_content = str_replace($post_search, $post_replace, $post->post_content); 138 $post['post_content'] = str_replace($post_search, $post_replace, $post['post_content']); 139 140 // Escape data pulled from DB. 141 $post = add_magic_quotes($post); 137 142 138 143 return wp_update_post($post);
Note: See TracChangeset
for help on using the changeset viewer.