How can I get the [video] shortcode to allow query string parameters?

You got two options.

Either you filter your valid video extentions as @birgire recommended.

I remember a similar issue for the audio shortcode here.

There I found a workaround by allowing the empty audio extension.

You could try something similar with the video extensions. Here’s a
demo plugin:

/**
 * Allow the empty video extension to support GET parameters
 */
add_filter( 'wp_video_extensions', function( $ext )
{
    $ext[] = '';
    return $ext;
} );

You should then restrict this further as needed, e.g. in a similar way
as I did with the audio shortcode.

I searched the trac tickets and found this one #30377 that’s being
worked on.

Or filter the whole shortcode to your needs with the filter wp_video_shortcode. E.g. add another attribute to the shortcode called type and modify the result to your need.

function my_video_shortcode($output, $atts, $video, $post_id, $library ) {
    /**
     * @param string $output  Video shortcode HTML output.
     * @param array  $atts    Array of video shortcode attributes.
     * @param string $video   Video file.
     * @param int    $post_id Post ID.
     * @param string $library Media library used for the video shortcode.
     */
}

Source: https://core.trac.wordpress.org/browser/tags/4.4.2/src/wp-includes/media.php#L2369

Leave a Comment