Support

Account

Home Forums General Issues Set featured image of CPT from existing image Reply To: Set featured image of CPT from existing image

  • Yes, there is. You create an acf/save_post action http://www.advancedcustomfields.com/resources/acfsave_post/

    In your function you get the value of the field which is stored as an ID. You can either do it with ACF using $image = get_field('image_field', $post_id, false); which will return the ID value or you can use $image = get_post_meta($post_id, '', true);

    then you do

    
    $image = intval($image); // make sure it's an int
    set_post_thumbnail($post_id, $image);
    

    But this won’t be retroactive, you’d need to update every post.