Available Filters for the ACF YouTube 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_youtube_reg_ex /^.*(youtu.be/|v/|u/w/|embed/|watch?v=|&v=)([^#&?]*).*/
acf_youtube_transient_time 28800

Default: /^.*(youtu.be/|v/|u/w/|embed/|watch?v=|&v=)([^#&?]*).*/

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

function hg_acf_youtube_reg_ex()
  return "NEW REGEX HERE";
add_filter('acf_youtube_reg_ex', 'hg_acf_youtube_reg_ex');

Default: 28800

This sets the transient cache time for the YouTube 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. The default isĀ 28800 (8 hours in seconds).

function hg_acf_youtube_transient_time()
  return 600000;
add_filter('acf_youtube_transient_time', 'hg_acf_youtube_transient_time');