Skip to content

Instantly share code, notes, and snippets.

@yanknudtskov
Created January 30, 2016 21:20
Show Gist options
  • Save yanknudtskov/f384fa699875943c9184 to your computer and use it in GitHub Desktop.
Save yanknudtskov/f384fa699875943c9184 to your computer and use it in GitHub Desktop.
Get video length in WordPress
<?php
$video_meta = get_post_meta( $attachment_ID, '_wp_attachment_metadata', true );
echo $video_meta['length_formatted'];
@MagdiElmowafy
Copy link

how can I get video attachment ID stored in $attachment_ID?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment