Skip to content

Instantly share code, notes, and snippets.

@spivurno
Created January 23, 2015 18:24
Show Gist options
  • Save spivurno/5df371f4b3c34115cb77 to your computer and use it in GitHub Desktop.
Save spivurno/5df371f4b3c34115cb77 to your computer and use it in GitHub Desktop.
Gravity Perks // GP Unique ID // Prepend Date to Unique ID
/**
* Gravity Perks // GP Unique ID // Prepend Date to Unique ID
*/
add_filter( 'gpui_unique_id', 'add_date_to_unique_id', 10, 3 );
function add_date_to_unique_id( $unique, $form_id, $field_id ) {
if( $form_id == 1 && $field_id == 2 ) {
// if $unique was "123", this would change it do something like "01132015_123"
$unique .= date( 'mdy' ) . '_' . $unique;
}
return $unique;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment