Skip to main content

How to set a Featured Image from an ACF custom field

By August 23, 2021No Comments1 min read

We recently created an Artist Directory website for a UK based client. The website is using Oxygenbuilder to output the website’s header, footer, post and page templates. We created a custom post type and custom post taxonomies for the Artist Listings using the Custom Post Type UI plugin.

For the custom fields we used the Advanced Custom Fields (ACF) Pro plugin.

Oxygenbuilder let’s us create dynamic custom post type templates.

By inserting a code snippet on the custom post template single page, we can allow the Artist to edit and manage the contents of their listing through a frontend form. The frontend form will only display if the artist is logged-in. Artists will only be able to edit their own listing – the post_author_id must match the current logged-in user-id.

Below is an example of the code snippet.

The next challenge was to allow the Artist to edit their listing’s Featured Image. A search on the ACF forum provided a solution.

Create a custom image field and name it “_thumbnail_id”. The ACF plugin will then auto-update the featured image of the custom post type.

This solution allows for a post author to edit the content of their post as well as the featured image through the frontend of the website as long as they are logged in.

Sherissa | Web Designer

Wordpress web designer, mom, wife, documentary photographer, compulsive researcher, rock-climber, table tennis enthusiast