Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support Paul Clark

    (@pdclark)

    • Create a Plain Text field
    • Under Field Options > Advanced, set Default Value to {@ID,UUID} —?this means use a function UUID() which takes the post ID as its parameter.
    • In wp-config.php, set define( 'PODS_SHORTCODE_ALLOW_EVALUATE_TAGS', true );
    • In a plugin or your theme’s functions.php, define a function UUID( $post_id ), which takes the Post ID as an argument and returns your desired UUID. For example:
    <?php
    
    function UUID( $post_id ) {
    	return md5( $post_id );
    }
    Thread Starter msowah

    (@msowah)

    can just use the wp_generate_uuid4() instead of using a custom function

    Plugin Support Paul Clark

    (@pdclark)

    Give it a try. It might not work because that function does not take a parameter. If it throws an error, write a function that takes one argument but returns wp_generate_uuid4().

    Thread Starter msowah

    (@msowah)

    Thanks worked out fine by return the wp_generate_uuid4() in the UUID function

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Defaulting a field to UUID()’ is closed to new replies.