WordPress.org

Make WordPress Core

Ticket #10521: 10521.diff

File 10521.diff, 895 bytes (added by ryan, 5 years ago)

Refreshed patch

  • xmlrpc.php

     
    22822282                global $wpdb; 
    22832283 
    22842284                // find any unattached files 
    2285                 $attachments = $wpdb->get_results( "SELECT ID, guid FROM {$wpdb->posts} WHERE post_parent = '-1' AND post_type = 'attachment'" ); 
     2285                $attachments = $wpdb->get_results( "SELECT ID, guid FROM {$wpdb->posts} WHERE post_parent = '0' AND post_type = 'attachment'" ); 
    22862286                if( is_array( $attachments ) ) { 
    22872287                        foreach( $attachments as $file ) { 
    22882288                                if( strpos( $post_content, $file->guid ) !== false ) { 
     
    28892889                        return new IXR_Error(500, $errorString); 
    28902890                } 
    28912891                // Construct the attachment array 
    2892                 // attach to post_id -1 
    2893                 $post_id = -1; 
     2892                // attach to post_id 0 
     2893                $post_id = 0; 
    28942894                $attachment = array( 
    28952895                        'post_title' => $name, 
    28962896                        'post_content' => '',