My version was 5.3.2.2, everything works good after update. Thank you John for your help and time.
Hi John, sorry for a long delay.
I tried to turn off all plugins but problem still the same.
So I have installed new wordpress and add there only one plugin ‘ACF pro’. I used ‘Twenty Fourteen’ theme and added there page with this code:
<?php
/**
* Template Name: ACF test page
*/
get_header(); ?>
<form method="POST" action="<?php the_permalink(); ?>" style="float: right;width: 200px;">
<input type="hidden" name="field_key" />
<input type="text" name="sub_field_one" />
<input type="text" name="sub_field_two" />
<input type="submit" value="Try it!" />
</form>
<div style="float: right">
<?php if($_POST): ?>
<?php
$post = array(
'post_title' => 'Title of new post',
'post_content' => '',
'post_status' => 'publish',
'post_type' => 'post'
);
$post_ID = wp_insert_post($post);
$row = array(// don't forget to change field keys
'field_56d6bdeb338e7' => $_POST['sub_field_one'],
'field_56d6be03338e8' => $_POST['sub_field_two']
);
$row_id = add_row('field_56d6bdd7338e6', $row, $post_ID);
echo $row_id;
?>
<?php endif ?>
</div>
<?php
get_sidebar();
get_footer();
Also I added ACF repeater with two text fields. So form on this page should create a new post and add there values from form to repeater subfields.
After submitting I saw an ID of new row – ‘1’ near form. But in admin panel I can’t see any value which I wrote in form.
Can you try it on your wordpress?
In my code $row is just an array
$row = array(
'location_select' => 603,
'available_sports' => array('sport')
);
$post_ID is an integer = 2575 – for example.