Enable `WPML String Translate` for Custom Limit Message

Code

Filename: gpls-enable-wpml-for-custom-limit-message.php

<?php
/**
 * Gravity Perks // Limit Submissions // Enable `WPML String Translate` for Custom Limit Message
 * https://gravitywiz.com/documentation/gravity-forms-limit-submissions/
 */
add_action( 'init', function() {
	if ( function_exists( 'icl_register_string' ) && function_exists( 'gp_limit_submissions' ) ) {
		$feeds = GFAPI::get_feeds( null, null, 'gp-limit-submissions', true );
		foreach ( $feeds as $feed ) {
			icl_register_string( 'gp-limit-submissions', "rule-limit-message-{$feed['id']}", $feed['meta']['rule_limit_message'] );
		}
	}
} );

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.