Opened 13 years ago
Closed 13 years ago
#24421 closed defect (bug) (worksforme)
Audio and Video Shortcodes not Displaying via Add Media (v3.6 Beta-3)
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Priority: | normal | |
| Severity: | major | Version: | 3.6 |
| Component: | Media | Keywords: | reporter-feedback |
| Focuses: | Cc: |
Description
If you use the Add Media button and insert a video or audio file from the library then it doesn't display. However, if you upload an audio file or video to that post then that shortcode works. That said, it has to be the appropriate media type (i.e. for video shortcode it has to be a video you're uploading).
If you remove lines 877-888 of wp_audio_shortcode and 996-1006 wp_video_shortcode then it seems to fix this. The problem being that get_attached_audio/video fails because there isn't anything attached, returning an empty array and so the code terminates (via return).
But if you remove those blocks it seems to display audio and video shortcodes fine.
Example of offending code:
#$audios causes shortcode to break if nothing was uploaded/attached to that post/page
if ( ! $primary ) {
$audios = get_attached_audio( $post_id );
if ( empty( $audios ) )
return;
$audio = reset( $audios );
$src = wp_get_attachment_url( $audio->ID );
if ( empty( $src ) )
return;
array_unshift( $default_types, 'src' );
}
Change History (6)
#3
@
13 years ago
Actually, I can no longer fully wrap my head around this bug report, and I can't seem to reproduce any issues inserting/embedding a non-attached audio or video file. (It's also possible it is no longer broken, but was two months ago.)
#5
@
13 years ago
Related: http://wordpress.org/support/topic/new-36-audiovideo-shortcodes.
Could not reproduce neither in 3.6-beta3 nor in current trunk.
Oof. This is bad. Thanks. Related: #24820.