Populate the Current Quarter

Instructions

Read the Walkthrough

Code

Filename: gw-populate-current-quarter.php

<?php
/**
 * Gravity Wiz // Gravity Forms // Populate the Current Quarter
 * https://gravitywiz.com/snippet-library/
 *
 * Instruction Video: https://www.loom.com/share/a8355c7ab85c42e88130a5eda11a1f81
 */
add_filter( 'gform_field_value_current_quarter', function() {

	$month   = gmdate( 'n' );
	$quarter = ceil( $month / 3 );

	return $quarter;
} );

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.