I am trying to follow the method described here (https://support.advancedcustomfields.com/forums/topic/set-image-as-featured-image). But It’s not working whatever I do. There is no change in the featured image. Note, I am in a custom post type.
This is added to my themes functions.php
function acf_set_featured_image( $value, $post_id, $field ){
if($value != ''){
//Add the value which is the image ID to the _thumbnail_id meta data for the current post
update_post_meta($post_id, '_thumbnail_id', $value);
}
return $value;
}
// acf/update_value/name={$field_name} - filter for a specific field based on it's name
add_filter('acf/update_value/name=character_featured_image', 'acf_set_featured_image', 10, 3);
This is my field group.
https://ibb.co/XJ2wJJv
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.