Types is a WordPress plugin that lets you easily create custom post types and add your own types of data to your website through the WordPress admin screen. You can also associate the content types with taxonomies and fields.
When you ask for help or report issues, make sure to tell us what you have created so far and what you want to achieve.
Problem:
The customer wants to set a custom field as the featured image for an entire custom post type. They are looking for a solution to establish this custom field globally for each post, as they did not find an existing feature in the documentation that meets this requirement.
Solution:
We informed the customer that there is no built-in feature within Toolset to directly set a custom field as the featured image. However, we provided a workaround involving the following steps:
Use the save_post action hook to trigger a PHP function when a post is saved.
Use the get_post_meta function to retrieve the custom image field value.
Retrieve the remote image file using cURL.
Save the image into the WordPress media library using wp_insert_attachment.
Set the media ID as the post's featured image using set_post_thumbnail.
Additionally, we shared a link to a forum post where a colleague provided a working example of code that runs through all posts of a specific custom post type, assigning a given custom field as the featured image.