Opened 10 years ago
Last modified 7 years ago
#39521 new defect (bug)
media_handle_sideload does not initialize the caption/excerpt value
| Reported by: | dglingren | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | Awaiting Review |
| Component: | Media | Version: | 2.6 |
| Severity: | normal | Keywords: | |
| Cc: | Focuses: |
Description
In /wp-admin/includes/media.php changes have been made in the media_handle_upload() function to initialize the caption/excerpt value after an upload. Here's the code:
<?php // Construct the attachment array $attachment = array_merge( array( 'post_mime_type' => $type, 'guid' => $url, 'post_parent' => $post_id, 'post_title' => $title, 'post_content' => $content, 'post_excerpt' => $excerpt, ), $post_data );
Corresponding changes should be made in the media_handle_sideload() function, which still has:
<?php // Construct the attachment array. $attachment = array_merge( array( 'post_mime_type' => $type, 'guid' => $url, 'post_parent' => $post_id, 'post_title' => $title, 'post_content' => $content, ), $post_data )
Attachments (1)
Change History (6)
This ticket was mentioned in Slack in #core-media by mike. View the logs.
8 years ago
#4
@
8 years ago
- Keywords has-patch needs-refresh removed
Looking into this it seems like the patch tries to use $excerpt which doesn't exist inside media_handle_sideload(). It also looks like the $content variable in sideload is the same as the $excerpt variable media_handle_upload(). To bring parity between the two is seems like that needs to go into post_excerpt and the functionality for filling in $content needs to be brought over from media_handle_upload().
Having said all that: I'm not sure of the historical context here or why these seem to be treating content/excerpt differently. Some more digging is needed, but I'm removing the has-patch tag since the patch here won't fix the issue.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
initial patch