[wp-trac] [WordPress Trac] #15432: media_handle_sideload() is not returning right value

WordPress Trac wp-trac at lists.automattic.com
Mon Nov 15 12:30:55 UTC 2010


#15432: media_handle_sideload() is not returning right value
--------------------------+-------------------------------------------------
 Reporter:  acsnaterse    |       Owner:  joostdevalk    
     Type:  defect (bug)  |      Status:  new            
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Media         |     Version:  3.0.1          
 Severity:  normal        |    Keywords:                 
--------------------------+-------------------------------------------------
 The media_handle_sideload() is not return the right value. Just like the
 media_handle_upload you would expect the $id as integer return value, but
 it returns the URL string.

 This is happening in the last lines of the function:

 {{{
 // Save the attachment metadata
 $id = wp_insert_attachment($attachment, $file, $post_id);

 if ( !is_wp_error($id) ) {
         wp_update_attachment_metadata( $id,
 wp_generate_attachment_metadata( $id, $file ) );
         return $url;
 }
 return $id;
 }}}

 Also where this function is used ( in media_sideload_image() ) it is
 expecting the ID as return value.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/15432>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list