更新密钥时会出现此代码name
.
File: wp-content/plugins/advanced-custom-fields/core/fields/_functions.php
193: foreach( array(\'key\', \'name\', \'type\') as $key )
194: {
195: // run filters
196: $value = apply_filters(\'acf/update_value/\' . $key . \'=\' . $field[ $key ], $value, $post_id, $field); // new filter
197: }
尝试:打印$value、$post\\u id、$字段以了解您拥有的内容。。。可能你有一些错误的标签。。。
function acf_set_featured_image( $value, $post_id, $field ){
// print $value, $post_id, $field to understand what you have...
print_r(...);
wp_die();
if($value != \'\'){
//Add the value which is the image ID to the _thumbnail_id meta data for the current post
add_post_meta($post_id, \'_thumbnail_id\', $value);
}
return $value;
}
// acf/update_value/name={$field_name} - filter for a specific field based on it\'s name
add_filter(\'acf/update_value/name=video_thumbnail\', \'acf_set_featured_image\', 10, 3);