Solution: 将此添加到函数。php和刷新管理一次。之后删除。
function process_post() {
$my_posts = get_posts( array(\'post_type\' => \'page\', \'posts_per_page\' => -1 ) );
foreach ( $my_posts as $my_post ) :
$value = get_field(\'course_content\', $my_post->ID );
if($value):
$update_post = array(
\'ID\' => $my_post->ID,
\'post_content\' => $value
);
wp_update_post( $update_post );
endif;
endforeach;
}
add_action( \'init\', \'process_post\' );
nbsp;
我还注意到一些字段在后端可见,但在站点上无法呈现。可能是某种类型的数据库缓存。我通过使用类似的逻辑刷新字段值来修复此问题:
function process_post() {
$my_posts = get_posts( array(\'post_type\' => \'page\', \'posts_per_page\' => -1 ) );
foreach ( $my_posts as $my_post ) :
$value = get_field(\'field_560094b2af64e\', $my_post->ID );
if($value):
update_field( \'field_560094b2af64e\', $value, $my_post );
endif;
endforeach;
}
add_action( \'init\', \'process_post\' );