Disable Limits for Logged-in Users

Instructions

Code

Filename: gpwc-disable-limits-for-logged-in-users.php

<?php
/**
 * Gravity Perks // Word Count // Disable Limits for Logged-in Users
 * https://gravitywiz.com/documentation/gravity-forms-word-count/
 *
 * Instruction Video: https://www.loom.com/share/5336fdfc3be44907a41722b7ad9b3732
 */
// Update "123" to your form ID.
add_action( 'gform_pre_render_123', 'gpwc_remove_limits_for_logged_in_user' );
add_action( 'gform_pre_process_123', 'gpwc_remove_limits_for_logged_in_user' );
function gpwc_remove_limits_for_logged_in_user( $form ) {

	if ( ! is_user_logged_in() ) {
		return $form;
	}

	foreach ( $form['fields'] as &$field ) {
		$field->gwwordcount_min_word_count = null;
		$field->gwwordcount_max_word_count = null;
	}

	return $form;
}

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.