Home Forums ACF PRO Connect ACF to Featured Image. Reply To: Connect ACF to Featured Image.

  • If an ACF field can be used to set a featured image, can’t you simply use the same field names.

    So if someone adds to the featured image, does it not add to the ACF field? Not tried it but in theory, should be the same function.

    I believe you need the field as an image with the label of post_image.

    Possibly more to it, I don’t know.

    You may need to reverse the following code:

    add_action('acf/save_post', function ($post_id) {
        $value = get_field('post_image', $post_id);
        if ($value) {
            if (!is_numeric($value)) {
                $value = $value['ID'];
            update_post_meta($post_id, '_thumbnail_id', $value);
        } else {
            delete_post_meta($post_id, '_thumbnail_id');
    }, 11);

    But get the featured post ID using get_post_thumbnail_id then pass the value/details back to your ACF field