How would I set the featured of image of a post to be the image (an ACF User field) of the post author so that anywhere my theme uses the featured image, the author's image appears instead.

I'm aware of set_post_thumbnail, but I'm not sure which action or filter to use to make the change globally.

1 Answer 1


If you use the save_post hook, every time content is published or updated, the featured image will be refreshed. Note: make sure ACF is set to return an image ID, which is not its default.

add_action( 'save_post', 'wpse_set_featured_image' );
function wpse_set_featured_image($post_id) {
    // get author id
    $author_id = get_the_author_id($post_id);
    // get author's image
    $author_image_id = get_user_meta($author_id, 'your_acf_img_var_name', true);
    // fallback image
    if(empty($author_image_id)) {
        // set to an existing image ID to use as a fallback
        $author_image_id = '4';
    // at last, set the post featured image
    set_post_thumbnail($post_id, $author_image_id);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.