• hello ,

    /** ACF makes first gallery image featured image**/
    
    add_filter('acf/save_post', 'gallery_to_thumbnail');
    function gallery_to_thumbnail($post_id) {
    	$gallery = get_field('gallery', $post_id, false); //your gallery field name here
    	if (!empty($gallery)) {
    		$image_id = $gallery[0];
    		set_post_thumbnail($post_id, $image_id);
    	}
    }

    my snippet to put the first image of the gallery field in the featured image of the post does not work in front end with your plugin.
    in backend it works normally.
    can you adapt it or include this senario?
    what your plugin can’t understand with my snippet

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘ACF makes first gallery image featured image’ is closed to new replies.