Make WordPress Core

Opened 5 years ago

Closed 5 years ago

#24421 closed defect (bug) (worksforme)

Audio and Video Shortcodes not Displaying via Add Media (v3.6 Beta-3)

Reported by: claregoult Owned by:
Milestone: Priority: normal
Severity: major Version: 3.6
Component: Media Keywords: reporter-feedback
Focuses: Cc:


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 ) )

		$audio = reset( $audios );
		$src = wp_get_attachment_url( $audio->ID );
		if ( empty( $src ) )

		array_unshift( $default_types, 'src' );

Change History (6)

#1 @SergeyBiryukov
5 years ago

  • Version set to trunk

#2 @nacin
5 years ago

  • Milestone changed from Awaiting Review to 3.6

Oof. This is bad. Thanks. Related: #24820.

#3 @nacin
5 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.)

#4 @aaroncampbell
5 years ago

  • Keywords reporter-feedback added

I can't seem to replicate this either. Perhaps it was related to #24449 and fixed in [24777]?

claregoult: Can you still replicate this issue with the current trunk?

#5 @SergeyBiryukov
5 years ago

Related: http://wordpress.org/support/topic/new-36-audiovideo-shortcodes.

Could not reproduce neither in 3.6-beta3 nor in current trunk.

#6 @nacin
5 years ago

  • Milestone 3.6 deleted
  • Resolution set to worksforme
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.