ACF Values Don’t Show After Import Unless I Edit/Update Post
Question
I am importing CPT’s using WP All Import which include ACF field values. When I import, the values don’t show on the front end unless I open/edit/publish. I have tried several options including bulk edit (tags, etc) as well as a code snippet I found, but nothing seems to work. Here’s the snippet I am currently using, with menu_item being the post type.
Any help would be AWESOME. Thanks ahead of time!
function my_update_posts() {
//$myposts = get_posts('showposts=-1');//Retrieve the posts you are targeting
$args = array(
'post_type' => 'menu_items',
'numberposts' => -1
);
$myposts = get_posts($args);
foreach ($myposts as $mypost){
$mypost->post_title = $mypost->post_title.'';
wp_update_post( $mypost );
}
}
add_action( 'wp_loaded', 'my_update_posts' );
0
advanced-custom-fields, bulk-import, custom-post-types, import
3 years
2020-03-31T20:50:49-05:00
2020-03-31T20:50:49-05:00 0 Answers
81 views
0
Leave an answer