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!
2022 was a big year for Advanced Custom Fields, with more capabilities, a new generation of ACF Blocks, a refreshed UI, and a new home. Our year in review post looks at advancements we’ve made and offers a glimpse of the future.
— Advanced Custom Fields (@wp_acf) January 6, 2023
https://t.co/HahJUCcyH4
© 2023 Advanced Custom Fields.
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 Cookie Policy. If you continue to use this site, you consent to our use of cookies.