• Resolved phillycheese10001

    (@phillycheese10001)


    I am trying to get the cropped image to be set as “Featured Image” I have a submission form which sets the featured image when the the field type is only “image” But when i set it to “Image with user-crop” it no longer registers as the featured image.
    here is my code in functions.php:

    // Set Featured Image from ACF Field
    function acf_set_featured_image( $value, $post_id, $field ) {
    if($value != ”){
    update_post_meta($post_id, ‘_thumbnail_id’, $value);
    } else {
    if ( has_post_thumbnail() ) {
    delete_post_thumbnail( $post_id);
    }
    }
    return $value;
    }
    add_filter(‘acf/update_value/name=tsm_featured_image’, ‘acf_set_featured_image’, 10, 3);

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Setting as Featured Image’ is closed to new replies.