To make sure you’re getting the correct path to the video, pass the ID to get_attached_file()
, and use that in wp_read_video_metadata()
. wp_upload_dir()
is for getting/creating a directory to write to now, so if the file has not been uploaded in the current month, the path will not be correct if you just add it to the filename.
$attachment_id = get_field( 'video_file', $post->ID, false); // Get the raw value, the attachment ID.
$file = get_attached_file( $attachment_id );
$metadata = wp_read_video_metadata( $file );
Related Posts:
- Escaping Quotes
- Displaying a video on the homepage via a custom field inside a php widget
- How do I upload file through custom field, save it to database and get it
- Do_Shortcode not working for Embed
- ORDER BY custom field value
- How can I avoid re-inventing the Custom Fields wheel in my Plugin’s Metabox?
- Using wordpress post data as input for google visualisations
- Does wordpress have something like content-type?
- How to get and edit custom fields if in Quick Edit
- Order posts by custom field and if custom field is empty return remaining posts
- Can serialized arrays in DB be matched against serialized arrays with meta_query?
- Create custom field on post draft or publish?
- Create a select drop down of available menus
- Adding a prefix to a post title
- copy attachments to another post type and change attachment url
- Cannot edit post meta fields with rest API
- Only display custom field if it there is a value inside
- Slow meta query with multi meta keys
- Custom Field Multiple Clauses
- Add a post meta key and value only if it does not exist on the post
- Custom field values repeating
- Sorting posts by multiple values, combined
- Send Multiple Custom Field Values Through the URL
- WP_Meta_Query causing long-running MySQL queries
- $wp_query meta_key naming issue [closed]
- Meta_query and numeric comparison [closed]
- Separate table or usermeta
- Woocommerce with metabox plugin
- trim custom field text value and show (…)
- Duplicate posts being displayed when querying Custom Fields
- using multiple meta_key and meta_value in query_posts
- Json api does not return all metadata
- Use custom field as a variable
- ACF: How to get the full field name (meta_key) by a field key?
- Tweak Meta for Post to work it for Pages also
- global function to apply filter to custom field
- How to add a new meta key and assign timestamp to posts
- How to select posts from multiple categories and metavalues?
- Print custom field in Query Loop block
- Is there a simpler version of WP Media?
- Order RSS content by an advanced custom field value
- Advanced search by two criteria – sort by location and date (ascending or descending)
- modify wordpress caption shortcode
- UPDATE on SELECT results. A SQL query to swap Author with Meta Box value
- Alter main archive, to show posts with meta as last
- Add microdata from schema.org [closed]
- Displaying multiple URLs as custom field values
- Collect user custom field in product page woocommerce
- How can I save custom meta to one global value?
- Stop sending email everytime I updates my post
- Best way to store everyday post views?
- get posts where a custom field contains a text
- Displaying a custom field
- How to use media upload on metabox post page without breaking TinyMCE?
- Branch made by several custom values
- Modify date query by URL parameter using pre_get_posts and $_GET
- Upload & include specific JavaScript files for posts?
- help for user login
- The best way to collision check in WP
- Get meta field value of all catgories
- How to store meta field values
- Group Posts By Custom Meta Value: Date
- Change Page Order by Custom Field (Magic Fields)
- Custom Field is getting the value of another page/post instead of the current one?
- Custom Field: how to save array of multiple key-values in WordPress
- How can I detect user’s timezone?
- ACF field group not showing in page
- Filter post style attribute
- Update some (not all) post titles with custom field values before running the Loop
- Arrays in custom fields or is there a better way?
- Use value from ACF to populate other fields
- Dynamically populate query source in Elementor post widget
- Custom field in media library not saving, selected() function not adding “selected” to select list input type
- Setting user permissions per post
- Adding Facebook’s image and meta description retrieval capabilities to a WordPress post
- Weird custom fields data lost
- Showing the post only when there is title, thumbnail and the content in Custom Fields
- WooCommerce 3 get custom variation on process order [closed]
- query_posts -> get page_id from custom field
- Custom field group on page
- Output Custom Field value to shortcode
- Update custom table on metabox POST
- display custom media folders to wordpress media popup
- Should I store arrays in custom fields or create custom tables?
- Problem saving meta data
- change attachment custom field onChange event
- Custom Meta Boxes and Fields for WordPress: Change directory upload based on user-edit page
- WP_query returns error when used for custom widget
- How to filter post using custom feild value in shortest and longest duration?
- Get custom field from other post in carousel
- Form fields based on custom fields
- show custom field content in jquery tabs
- Create citation and url in post using 3 custom fields with conditions for each field… So close!
- woocommerce how in checkout to add my custom field check box, and when i check it hide the shipping adress and add tax 19% [closed]
- How can I attach files without using a plugin?
- Show only first image of multiple image field
- Change Fields of Comments and make them searchable?
- Custom Fields after update to WordPress 6
- Multiple triggers when publishing, saving or updating a post in WordPress
- If possible a field ID transfom in a Custom Field?