Title: Advanced Custom Fields compatibility.
Last modified: August 22, 2016

---

# Advanced Custom Fields compatibility.

 *  Resolved [deyson](https://wordpress.org/support/users/deyson/)
 * (@deyson)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/advanced-custom-fields-compatibility/)
 * This plugin would be a huge time saver for me. Will it be able to grab a link
   from advanced custom field?
 * Thank you 🙂
 * [https://wordpress.org/plugins/automatic-featured-images-from-videos/](https://wordpress.org/plugins/automatic-featured-images-from-videos/)

Viewing 6 replies - 1 through 6 (of 6 total)

 *  Plugin Support [Michael Beckwith](https://wordpress.org/support/users/tw2113/)
 * (@tw2113)
 * The BenchPresser
 * [11 years, 3 months ago](https://wordpress.org/support/topic/advanced-custom-fields-compatibility/#post-5729487)
 * Hi Deyson, I was going to say “not really” but I decided to look over the plugin
   code first anyway, and found this little nugget:
 *     ```
       // allow developers to filter the content to allow for searching in postmeta or other places
       $content = apply_filters( 'wds_featured_images_from_video_filter_content', $content );
       ```
   
 * You could replace the returned `$content` variable with your custom field data
   from ACF and make sure the youtube/vimeo url is in the returned value
    to be 
   parsed out via regex.
 * After that, if I’m reading the code properly, it will do the rest automagically
   for you.
 *  Thread Starter [deyson](https://wordpress.org/support/users/deyson/)
 * (@deyson)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/advanced-custom-fields-compatibility/#post-5729502)
 * Ok thank you I will give it a try. 🙂
 *  [physalis](https://wordpress.org/support/users/physalis/)
 * (@physalis)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/advanced-custom-fields-compatibility/#post-5729714)
 * Hi Michael and Deyson,
 * that sounds great, however, could you elaborate on how to actually use your nugget?
   Let’s say I have an HTML-filled field ‘media’ for my posts that contains the 
   YouTube URL, how would I make your plugin search this field?
 *     ```
       // allow developers to filter the content to allow for searching in postmeta or other places
       $media_field = get_field('media');
       $content = apply_filters( 'wds_featured_images_from_video_filter_content', $media_field );
       ```
   
 * does not look right to me :-/. Thanks in advance!
 *  Plugin Support [Michael Beckwith](https://wordpress.org/support/users/tw2113/)
 * (@tw2113)
 * The BenchPresser
 * [11 years, 2 months ago](https://wordpress.org/support/topic/advanced-custom-fields-compatibility/#post-5729715)
 *     ```
       function physalis_fetch_youtube_image( $content ) {
           $media_field = get_field( 'media' );
           if ( ! empty( $media_field ) ) {
               return $media_field;
           }
   
           return $content;
       }
       add_filter( 'wds_featured_images_from_video_filter_content', 'physalis_fetch_youtube_image' );
       ```
   
 * In this filter, we fetch the media field you want, and if we have something to
   return, we return that, if we do not, we just return the original value. Basically
   passing back the $media_field value to be searched instead of the original. You’d
   want to place this in your functions.php file for your current theme, or in a
   custom plugin if it needs to not be theme-dependent.
 *  [physalis](https://wordpress.org/support/users/physalis/)
 * (@physalis)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/advanced-custom-fields-compatibility/#post-5729716)
 * Woah, thank you so much!
 * However, one more basic question – how exactly does this plugin work? What image
   size does it fetch, and does it include already published posts? Or how would
   I make it work? Does it automatically fill empty post_thumbnail fields?
 *  Plugin Support [Michael Beckwith](https://wordpress.org/support/users/tw2113/)
 * (@tw2113)
 * The BenchPresser
 * [11 years, 2 months ago](https://wordpress.org/support/topic/advanced-custom-fields-compatibility/#post-5729717)
 * Looks like it checks for the `maxresdefault` image size from YouTube, and if 
   that doesn’t exist, it moves to `hqdefault`.
 * It doesn’t recursively do its thing for all existing posts, you have to trigger
   it by editing and then saving a post.

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Advanced Custom Fields compatibility.’ is closed to new replies.

 * ![](https://ps.w.org/automatic-featured-images-from-videos/assets/icon-256x256.
   png?rev=2744400)
 * [Automatic Featured Images from Videos](https://wordpress.org/plugins/automatic-featured-images-from-videos/)
 * [Support Threads](https://wordpress.org/support/plugin/automatic-featured-images-from-videos/)
 * [Active Topics](https://wordpress.org/support/plugin/automatic-featured-images-from-videos/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/automatic-featured-images-from-videos/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/automatic-featured-images-from-videos/reviews/)

 * 6 replies
 * 3 participants
 * Last reply from: [Michael Beckwith](https://wordpress.org/support/users/tw2113/)
 * Last activity: [11 years, 2 months ago](https://wordpress.org/support/topic/advanced-custom-fields-compatibility/#post-5729717)
 * Status: resolved