Home › Forums › Front-end Issues › Pass new $post_id to url or… › Reply To: Pass new $post_id to url or…
Hi @synergywp
I am confused.
What version of ACF are you using? v4 or v5(PRO)?
If you are using ACF PRO, you have used the wrong acf_form documentation. Please note the documentation versions: http://www.advancedcustomfields.com/resources/acf_form/
In short, there are a few issues with your code so PLEASE do lots of debugging line by line to make sure your code is actually running.
1. The args …
'post_id' => 'new_post',
'new_post' => array(
'post_status' => 'draft',
'post_type' => $cpt,
//'post_title' => 'new listing'
),
… are only available in ACF5 (ACF PRO).
2.
Your code:
if( $post_id != 'new' ) {
return $post_id;
}
… will most likely always return, because your post_id is ‘new_post’, not ‘new’.
PLEASE debug your code line by line to ensure it is running and all variables are correct. Also debug the $GLOBALS vs $_POST array to see what data is available.
Thanks
E
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’re reaching out to our multilingual users to ask for help in translating ACF 6.1. Help make sure the latest features are available in your language here: https://t.co/TkEc2Exd6U
— Advanced Custom Fields (@wp_acf) May 22, 2023
© 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.