Ticket #2434: attachment-fix.diff

File attachment-fix.diff, 725 bytes (added by dougal, 6 years ago)

Fixes escaping problem which occurs in posts with attachments.

  • admin-functions.php

    old new  
    102102 
    103103                // While we have the attachment ID, let's adopt any orphans. 
    104104                $attachment = & get_post($id); 
    105                 if ( ! is_object(get_post($attachment->post_parent)) ) { 
     105                if ( $attachment->ID && ! is_object(get_post($attachment->post_parent)) ) { 
    106106                        $attachment->post_parent = $post_ID; 
    107107                        wp_update_post($attachment); 
    108108                } 
     
    112112                ++$i; 
    113113        } 
    114114 
    115         $post->post_content = str_replace($post_search, $post_replace, $post->post_content); 
     115        $post->post_content = addslashes_gpc(str_replace($post_search, $post_replace, $post->post_content)); 
    116116 
    117117        return wp_update_post($post); 
    118118}