[wp-trac] [WordPress Trac] #36285: Inconsistency between the filters that can be used to override the default shortcode output for images/videos/audio
WordPress Trac
noreply at wordpress.org
Mon Mar 21 18:16:02 UTC 2016
#36285: Inconsistency between the filters that can be used to override the default
shortcode output for images/videos/audio
--------------------------+-----------------------------
Reporter: gnotaras | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version:
Severity: normal | Keywords:
Focuses: |
--------------------------+-----------------------------
Currently, in order to override the default output of the {{{caption}}},
{{{video}}} and {{{audio}}} shortcodes, you have to use the following
respectively:
{{{
apply_filters( 'img_caption_shortcode', '', $attr, $content );
apply_filters( 'wp_audio_shortcode_override', '', $attr, $content,
$instance );
apply_filters( 'wp_video_shortcode_override', '', $attr, $content,
$instance );
}}}
Imho, there should be some consistency between these regarding the
following:
* hook name.
* arguments passed to the filtering function.
Also, it would be very useful if the attachment ID was also passed to the
filtering function.
Right now, the attachment ID of images can be obtained from
{{{$attr['id']}}}, which gives {{{attachment_IDNUMBER}}}, while the ID of
video and audio attachments can only be obtained by using the media file
URL found in the {{{$attr}}} array and directly querying the database in
order to get the post ID based on the {{{guid}}} field.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/36285>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list