Support

Account

Home Forums Backend Issues (wp-admin) Get featured image and save as field Reply To: Get featured image and save as field

  • It works inverting the terms 🙂

    add_action('acf/save_post', 'move_image_to_post_thumbnail');
    function move_image_to_post_thumbnail($post_id) {
      if (get_field('_thumbnail_id', $post_id, false)) {
        // get unformatted value
        // we did it above too, no point formatting the value for this
        $image_id = get_field('_thumbnail_id', $post_id, false);
        update_post_meta($post_id, 'image', $image_id);
      }
    }