Use Newline As The Delimiter for Paragraph Text fields

Code

Filename: gppa-use-new-line-as-delimiter.php

<?php
/**
 * Gravity Perks // GP Populate Anything // Use Newline As The Delimiter for Paragraph Text fields
 * https://gravitywiz.com/documentation/gravity-forms-populate-anything/
 */
add_filter( 'gppa_array_value_to_text', function( $text_value, $array_value, $field ) {
	if ( $field->type !== 'textarea' ) {
		return $text_value;
	}
	return implode( "\n", $array_value );
}, 11, 3 );

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.