Using the Video Object Return Value

A breakdown of the video object properties.

When you are adding your field in the groups section of the Advanced Custom fields area, you can select the type of return value to get. If you select the Video Object return value you will be able to access a nicely crafted object pulling in data from the YouTube API.

video-object-return-value

When available the video object pings the YouTube API to gather in specifics about your video. You can use this data to recreate a YouTube type experience on your WordPress site. We use the WordPress Transient API to cache your results for 8 hours (filter available).

The image below shows you the exact object properties that gets returned.

acf-youtube-field-video-object

Code Examples

Displaying a title, description and the embed. Click image to view this snippet and copy the code.
youtube-example