Support

Account

Home Forums Add-ons Repeater Field Set image from first row of repeater as featured image

Unread

Set image from first row of repeater as featured image

  • I‘m trying to complete the function from Jonathan to get image from first row of repeater as featured image.

    function acf_set_featured_image( $value, $post_id, $field  ){   
    
        if($value != ''){
    
        	delete_post_thumbnail( $post_id);
    	    //Add the value which is the image ID to the _thumbnail_id meta data for the current post
    	    add_post_meta($post_id, '_thumbnail_id', $value);
        }
        return $value;
        
    }
    add_filter('acf/update_value/key=field_5b07f3b27ce14', 'acf_set_featured_image', 10, 3);

    Thanks for your help.

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.