Make WordPress Core

Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#32855 closed defect (bug) (fixed)

wp_audio_shortcode() and wp_video_shortcode() ignoring input $attr['id']

Reported by: thorbrink's profile thorbrink Owned by:
Milestone: 4.3 Priority: normal
Severity: normal Version: 3.6
Component: Media Keywords: needs-patch
Focuses: Cc:

Description

wp_audio_shortcode() and wp_video_shortcode() both takes an id as a part of the first input parameter. Both of these functions ignore the id input and sets the value of the id-attribute to default value.

Change History (8)

#1 @wonderboymusic
9 years ago

  • Component changed from Shortcodes to Media
  • Keywords needs-patch added
  • Type changed from defect (bug) to enhancement
  • Version changed from 4.2.2 to 3.6

Hi thorbrink, this is unlikely to change ... the id is set dynamically so that it is guaranteed to be unique. If [audio|video] were to take an id param, it would probably represent an attachment's id in the database. Currently, the implementation is URL-based. This allows you to write the shortcodes by hand and easily point at an asset stored on a CDN. It is also difficult to associate sub-attachments through our current UI by linking attachment IDs in a parent-child relationship.

I'll leave this open in case you or others can come up with a clever idea to support custom HTML IDs.

#2 @aaroncampbell
9 years ago

I agree with @wonderboymusic here, but would add that we should fix the documentation on those functions so that we aren't telling people they can pass in an ID.

#3 @wonderboymusic
9 years ago

oh man, I missed that docs error - fixing now, good catch!

#4 follow-up: @wonderboymusic
9 years ago

In 33025:

wp_audio|video_shortcode() doesn't allow you to pass id, the docs shall reflect that.

Props thorbrink.
See #32855.

#5 @wonderboymusic
9 years ago

  • Milestone changed from Awaiting Review to 4.3
  • Type changed from enhancement to defect (bug)

#6 @wonderboymusic
9 years ago

  • Resolution set to fixed
  • Status changed from new to closed

The docs have been fixed - this should alleviate the confusion here. I would say wontfix for now on the id attribute, which is unused by JS anyways.

#7 @aaroncampbell
9 years ago

@wonderboymusic I was going to make a patch as soon as I got a coffee refill. No time to recaffeinate with you around!

#8 in reply to: ↑ 4 @thorbrink
9 years ago

Thanks @wonderboymusic. I reported, prepared a patch and went to the train, didn't even get to the station before you had it fixed. Cheers

Note: See TracTickets for help on using tickets.