Extract First Character From Live Merge Tag

Extract the first character of a string using when a Live Merge Tag. This is useful when you need the first letter of a name, for example.

Code

Filename: gppa-lmt-extract-first-character.php

<?php
/**
 * Gravity Perks // Populate Anything // Extract First Character From Live Merge Tag
 * https://gravitywiz.com/documentation/gravity-forms-populate-anything/
 *
 * Extract the first character of a string using when a Live Merge Tag.
 * This is useful when you need the first letter of a name, for example.
 */
// Update "123" to your form ID; and "4" to the field ID you are copying from.
add_filter( 'gppa_live_merge_tag_value_123_4', function( $value ) {
	return substr( $value, 0, 1 );
} );

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.