Answer the question
In order to leave comments, you need to log in
How to update custom fields via update_field?
There is a code with which I select all posts and update the service field in them. But the problem is that a post, for example, has 5 services, but the first service is taken and duplicated. Tell me what am I doing wrong?
$recent2 = new WP_Query(
array(
'orderby' => '',
'showposts'=>-1,
)
);
while($recent2->have_posts()) : $recent2->the_post() ;
$count = get_field('uslugi');
update_field('uslugi', $count);
?>
<?php endwhile; ?>
<?php wp_reset_query() ; ?>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question