Available Filters for the ACF Video Field

There are a handful of hooks you can tap into. The basic way to utilize these is like the example below. Check out this article by Pippin to get a better grasp of this functionality.

Filter Default Value
acf_vimeo_category Basic
acf_vimeo_reg_ex /(?:www.)?vimeo.com/([0-9a-z-_]+)/
acf_vimeo_transient_time 28800
acf_vimeo_embed <iframe src="//player.vimeo.com/video/{VIDEO_ID}" width="500" height="281" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>

acf_vimeo_category
Default: Basic

When adding the vimeo field in the ‘customs fields’ admin section you can move it from the general category with this filter.

function hg_acf_vimeo_category()
{
  return "Content";
}
add_filter('acf_vimeo_category', 'hg_acf_vimeo_category');

acf_vimeo_reg_ex
Default: /(?:www.)?vimeo.com/([0-9a-z-_]+)/

This is used to set the Regular Expression used to extract the Vimeo ID. We have a pretty good one but if you ever need to change it, this will help you out.

function hg_acf_vimeo_reg_ex()
{
  return "NEW REGEX HERE";
}
add_filter('acf_vimeo_reg_ex', 'hg_acf_vimeo_reg_ex');

acf_vimeo_transient_time
Default: 28800

This sets the transient cache time for the Vimeo API data. When you select the Video Object as the return value, the plugin will cache the results to save time and speed. Change this to a number seconds.

function hg_acf_vimeo_transient_time()
{ 
  return 86400;
}
add_filter('acf_vimeo_transient_time', 'hg_acf_vimeo_transient_time');

acf_vimeo_embed
Default: <iframe src="//player.vimeo.com/video/{VIDEO_ID}" width="500" height="281" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>

This ’embed’ return value gives a very basic embed to use. This filter allows you to customize it’s output. The Video Object return type will be more helpful but this could be of use for specific cases.

function hg_acf_vimeo_embed( $default, $video_id )
{ 
  if( $video_id == 1342453245)
  {
    // DO SOMETHING CUSTOM FOR A SPECIFIC VIDEO
    return '<h2>My Latest Work!</h2><iframe src="//player.vimeo.com/video/' . $video_id . '" width="500" height="281" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>';
  }
  else
  {
    return $default;
  }
}
add_filter('acf_vimeo_embed', 'hg_acf_vimeo_embed', 10, 2);