Support

Account

Home Forums ACF PRO acf_form in wp-admin Reply To: acf_form in wp-admin

  • Hi @ryandorn

    You need to get the posted data by using the $_POST global variable because ACF won’t be able to save it correctly. Maybe something like this:

    // Action Hook
    function my_save_form($cpt_id) {
        if(is_admin()){
            
            // Check the posted data
            if( isset($_POST['acf']['field_012345678901a']) ){
                
                // Set it to a variable
                $posted_data = $_POST['acf']['field_012345678901a'];
                
                // Update the custom field
                update_field('field_name', $posted_data, $cpt_id);
                
                // or use update_post_meta
                //update_post_meta($cpt_id, 'test', $posted_data);
            }
            
            
        }
    
    };
    add_action('acf/save_post', 'my_save_form', 20);

    Hope this helps 🙂