Changeset 3587
- Timestamp:
- 03/02/2006 02:49:06 AM (20 years ago)
- File:
-
- 1 edited
-
branches/2.0/wp-admin/admin-functions.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/2.0/wp-admin/admin-functions.php
r3556 r3587 91 91 global $wp_rewrite; 92 92 93 $post = & get_post($post_ID );93 $post = & get_post($post_ID, ARRAY_A); 94 94 95 95 $search = "#<a[^>]+rel=('|\")[^'\"]*attachment[^>]*>#ie"; 96 96 97 97 // See if we have any rel="attachment" links 98 if ( 0 == preg_match_all($search, $post ->post_content, $anchor_matches, PREG_PATTERN_ORDER) )98 if ( 0 == preg_match_all($search, $post['post_content'], $anchor_matches, PREG_PATTERN_ORDER) ) 99 99 return; 100 100 … … 108 108 109 109 // While we have the attachment ID, let's adopt any orphans. 110 $attachment = & get_post($id); 111 if ( ! is_object(get_post($attachment->post_parent)) ) { 112 $attachment->post_parent = $post_ID; 110 $attachment = & get_post($id, ARRAY_A); 111 if ( ! empty($attachment) && ! is_object(get_post($attachment['post_parent'])) ) { 112 $attachment['post_parent'] = $post_ID; 113 // Escape data pulled from DB. 114 $attachment = add_magic_quotes($attachment); 113 115 wp_update_post($attachment); 114 116 } … … 119 121 } 120 122 121 $post->post_content = str_replace($post_search, $post_replace, $post->post_content); 123 $post['post_content'] = str_replace($post_search, $post_replace, $post['post_content']); 124 125 // Escape data pulled from DB. 126 $post = add_magic_quotes($post); 122 127 123 128 return wp_update_post($post);
Note: See TracChangeset
for help on using the changeset viewer.