WordPress.org

Make WordPress Core

Ticket #18310: 18310.diff

File 18310.diff, 518 bytes (added by ericmann, 4 years ago)

Automatically inserts a GUID if none was passed to wp_insert_attachment()

  • post.php

     
    37223722                $post_name = sanitize_title($post_title, $post_ID); 
    37233723                $wpdb->update( $wpdb->posts, compact("post_name"), array( 'ID' => $post_ID ) ); 
    37243724        } 
     3725         
     3726        // Set GUID 
     3727        if ( ! isset($guid) ) 
     3728                $wpdb->update ( $wpdb->posts, arrray( 'guid' => get_permalink( $post_ID ) ), array( 'ID' => $post_ID ) ); 
    37253729 
    37263730        wp_set_post_categories($post_ID, $post_category); 
    37273731