Support

Account

Forum Replies Created

  • I am struggling with the same “issue”, and I tried John Huebner’s example, but the function to generate the id doesn’t work (the value of the variable is null when echoed).

    add_filter('acf/prepare_field/key=field_62440b6868c96', 'is_readonly');
    
    function is_readonly($card_group_id) {
        $card_group_id['readonly'] = true;
        return $card_group_id;
    }
    
    add_action('acf/save_post',  'generate_cardgroup_id');
    
    $post_id = get_the_ID();
    
    function generate_cardgroup_id($post_id){
        if (!$rows['card_group_id']){
            $rows['card_group_id'] = uniqid($more_entropy);
        }
        $rows['card_group_id'] = 1234;
    }

    Please could someone have a look? I’m really frustrated 🙁

Viewing 1 post (of 1 total)