Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 1shiharat/9825544 to your computer and use it in GitHub Desktop.
Save 1shiharat/9825544 to your computer and use it in GitHub Desktop.
acf-repeater-image-convert-thumbnail
/**
* ACF
* リピーターリピーターフィールドでの一番はじめの画像をアイキャッチ画像にも設定する。
**/
function acf_set_featured_image( $value, $post_id, $field ){
if( $value != ''){
update_post_meta($post_id, '_thumbnail_id', $value);
} else {
delete_post_meta($post_id, '_thumbnail_id');
}
return $value;
}
add_filter('acf/update_value/name=work_images_0_work_image', 'acf_set_featured_image', 10, 3);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment