Home › Forums › Backend Issues (wp-admin) › Set image as featured image › Reply To: Set image as featured image
Thanks both of you for your replies! it’s stange to me, I did a search for _thumbnail_id
but did not find any documentation on it by WordPress so I thought it was something you created!
Thanks for the heads-up on the $value->ID
@Jonathan!
I want my post thumbnail to update on existing posts as well as to add on new posts so I went to update_post_meta
and removed the if
statement, now I have this:
//Auto assign Featured image from 'post_image'
function acf_set_featured_image( $value, $post_id, $field ){
update_post_meta($post_id, '_thumbnail_id', $value->ID);
return $value;
}
add_filter('acf/update_value/name=post_image', 'acf_set_featured_image', 10, 3);
which is not working…. What am I missing? thanks again!
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.