Home › Forums › Add-ons › Gallery Field › meta_input wp_insert_post acf gallery › Reply To: meta_input wp_insert_post acf gallery
Hello
Help me please
I used wp_insert_post to create new post in cpt
what needs to be sent to the field “meta_input” add to Data Picker in ACF?
when I send in data (ex 2029) POST all right – https://prnt.sc/1x73dvk
but in new post acf field (Data Picker) only 1970 – https://prnt.sc/1x72yu8
for other fields all ok
My code like this
$advert_name = $_POST[‘advert_name’];
$advert_rent_date = $_POST[‘advert_rent_date’];
$advert_new = [
‘ID’ => ”,
‘post_type’ => ‘offers’,
‘meta_input’ => [
‘name’ => $advert_name,
‘date’ => $advert_rent_date
],
‘post_content’ => $advert_desc,
‘post_title’ => $advert_title,
‘post_status’ => ‘pending’
];
$post_id = wp_insert_post($advert_new);
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.