I imported posts (and the ACF post_meta related to it) from one site to a new site using WP’s default WP post export/import (under tools). On the new site, I recreated the custom fields in the ACF menu (was easier than exporting/importing ACF using ACF as there were only a few repeater fields). The post_meta appears correct in wp-admin (when viewing the related imported page), but the ACF fields aren’t being read on the front-end. If I ‘update post’, regardless of whether I actually change any values, the fields are then ‘refreshed’ and work on the front-end like normal.
Is there a way to ‘refresh’ all posts / post_meta data?
Well.. I decided to just run an init query through every post and add the field values back into themselves. Here’s a snippet of what I used: (add once to functions, refresh /wp-admin, delete code)
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' );