Created
March 28, 2014 04:40
-
-
Save 1shiharat/9825544 to your computer and use it in GitHub Desktop.
acf-repeater-image-convert-thumbnail
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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