Finally sorted it out.
As I am using Advanced Custom Fields, I need to use the acf/save_post
hook with a priority greater than 10, so the get_field()
functions are available.
Downside is that this hook runs for every post type. As opposed to the WP native save_post
hook, with the ACF one you can’t hook it for a specific custom post type.
So I also added a condition to check if the post is of type “interel-tv-videos”, like if(!has_post_thumbnail($post_ID) and get_post_type($post_ID) == "interel-tv-videos"):