Skip to content

Instantly share code, notes, and snippets.

@spivurno
Last active October 7, 2016 01:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save spivurno/2c02cdc5f65365d0c5ab9acc026e8457 to your computer and use it in GitHub Desktop.
Save spivurno/2c02cdc5f65365d0c5ab9acc026e8457 to your computer and use it in GitHub Desktop.
GP Unique ID // Gravity Perks // Creates Date-specific Unique Sequences
<?php
/**
* GP Unique ID // Gravity Perks // Creates Date-specific Unique Sequences
* http://gravitywiz.com/
*
* Update the "123" to your form ID; update the "9" to your Unique ID field ID.
*/
add_filter( 'gpui_unique_id_attributes_123_9', function( $atts, $form_id, $field_id ) {
$date_slug = date( 'mdY' );
$atts['form_id'] = (int) $date_slug;
$atts['prefix'] = $date_slug;
$atts['length'] = 4;
return $atts;
}, 10, 3 );
@mandeep-plp
Copy link

Hello,

I had added this code to my theme's functions.php file. Now how can I add date to my unique id of GF

Thanks in advance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment