Creates Daily Sequential IDs

Make the sequence for a given Unique ID field specific to the current date. The sequence will automatically reset for the next day.

Code

Filename: gpuid-daily-sequential-ids.php

<?php
/**
 * GP Unique ID // Gravity Perks // Creates Daily Sequential IDs
 * https://gravitywiz.com/
 *
 * Make the sequence for a given Unique ID field specific to the current date. The sequence will automatically
 * reset for the next day.
 */
// Update "123" to your form ID and "4" to your Unique ID field.
add_filter( 'gpui_unique_id_attributes_123_4', function( $atts ) {
	$atts['form_id'] = (int) gmdate( 'Ymd' );
	return $atts;
} );

Leave a Reply

Your email address will not be published. Required fields are marked *

  • Trouble installing this snippet? See our troubleshooting tips.
  • Need to include code? Create a gist and link to it in your comment.
  • Reporting a bug? Provide a URL where this issue can be recreated.

By commenting, I understand that I may receive emails related to Gravity Wiz and can unsubscribe at any time.