Support

Account

Home Forums Front-end Issues ACF form Reply To: ACF form

  • hello,

    I have a form1 on page1 and a form2 on page2, i need to get the value submit by the forms, no matter for me if it is after on before the post is created in database.
    For now this is what i do but
    1. Don’t know if it’s the good hook
    2. Like in docs, i have hardcoded (field_5c33260621785) the fields to retrieve (is it no possible dynamically ?)
    3. In this function, how can i know if $_POST[‘acf’] comes from FORM1 or FORM2 ?
    4. THnaksss a lot !!!

    function my_acf_save_post( $post_id ) {
     	$fields = false;
      	if( isset($_POST['acf']) )
    	{
    // get taxonomy sent my form on PAGE A	
    $zones = $_POST['acf']['field_5c33260621785'];
             foreach ($zones as $z) {
             $term = get_term( $z, 'zones_de_marche' );
             $name .= $term->name ."\r\n"; 
             }
    
    	}
     
    $args = array( 
        'number_to' => '+33111111',
        'message' => $name
    ); 
    twl_send_sms( $args );
     
                     }
    
    add_action('acf/save_post', 'my_acf_save_post', 20);