Created
February 28, 2019 13:36
-
-
Save spivurno/d954ceb7b38e6ee676cee70082beddd5 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 // Date-specific Sequences | |
* http://gravitywiz.com/ | |
* | |
* Requirements: | |
* - Your form ID cannot be more than 3 digits. | |
* - Your field ID cannot be more than 2 digits. | |
*/ | |
// Update "123" to your form ID. Update "4" to your Unique ID field ID. | |
add_filter( 'gpui_unique_id_attributes_123_4', function( $atts, $form_id, $field_id ) { | |
// Generates a unique sequence identifier based on current date. | |
$atts['form_id'] = date( 'mdy' ); | |
// Add additional support for uniquely identifying this sequence by form and field. | |
$atts['field_id'] = substr( $form_id, 0, 3 ) . substr( $field_id, 0, 2 ); | |
return $atts; | |
}, 10, 3 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment