[wp-trac] [WordPress Trac] #24421: Audio and Video Shortcodes not Displaying via Add Media (v3.6 Beta-3)
WordPress Trac
noreply at wordpress.org
Sat May 25 16:10:07 UTC 2013
#24421: Audio and Video Shortcodes not Displaying via Add Media (v3.6 Beta-3)
--------------------------+-----------------------------
Reporter: claregoult | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Media | Version:
Severity: major | Keywords:
--------------------------+-----------------------------
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' );
}
}}}
--
Ticket URL: <http://core.trac.wordpress.org/ticket/24421>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list