Last active
October 7, 2016 01:12
-
-
Save spivurno/2c02cdc5f65365d0c5ab9acc026e8457 to your computer and use it in GitHub Desktop.
GP Unique ID // Gravity Perks // Creates Date-specific Unique Sequences
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.