It looks like Wordpress video short code does not support media fragments URI (.e.g. appending #t=10 for the video src for example), so something like this wont work:

[video width="854" height="480" src="https://www.domain.com/wp-content/uploads/2018/07/5898ca6e5276e4cd97c0bd730a2ed82c11780595-480p__80044.mp4#t=18" preload="metadata"][/video]

because adding #t=18 at the end of the video confuses the video tag to recognize it's a video. How can I solve this, other than using a traditional html video tag, is there a patch for wp_video_shortcode function for this to work, or any other workarounds?

Update #1

Problem specifically in this line wp-includes/media.php Line 2498 that outputs the video as just an anchor link:

    $type = wp_check_filetype( $atts['src'], wp_get_mime_types() );
    if ( ! in_array( strtolower( $type['ext'] ), $default_types ) ) {
        return sprintf( '<a class="wp-embedded-video" href="%s">%s</a>', esc_url( $atts['src'] ), esc_html( $atts['src'] ) );

Try embedding your video like this:

<video controls>
  <source src="https://www.domain.com/wp-content/uploads/2018/07/5898ca6e5276e4cd97c0bd730a2ed82c11780595-480p__80044.mp4#t=18" type="video/mp4" />

Paste this in your editor but make sure on the top right it is set to "Text" not "Visual". When you switch it back to "Visual" you will just see blank gray frame. Preview the post and you should see the video embedded with the start time.

Note the controls tag, if you remove that then the video won't load and it will just show you a screenshot. So what you are doing is essentially writing your own html embed code.

You can also add other tags to the video such as width / height, autoplay, etc.

Hope this helped!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.