Support

Account

Home Forums Backend Issues (wp-admin) Hidden GUID Field

Solving

Hidden GUID Field

  • Hi,

    Can I create a hidden field in ACF and when the post is saved use an action or filter to set a random GUID against it and save it.

    That GUID from that point never ever gets touched/updated ( i.e. get_post_meta exists condition inside the actions/filter ).

    Also could it work in a repeater.

    I’m having a complete developer brain meltdown today so thought I would ask the community.

  • Not sure what you mean by GUID? is this the value that is saved in the _posts table in WP?

  • No worries all, I probably really confused it.

    I just added a Text Field and added a CSS class of hidden-field and then just did this:

    add_filter('acf/update_value/key=XXXXXXXXX', 'my_acf_update_value', 10, 4);
    
    function my_acf_update_value( $value, $post_id, $field ) {
    
        if( !$value ) {
            return uniqid();
        } else {
            return $value;
        }
    
    }
Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.