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:

    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).


    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.