Prevent Redirect Caching

Adds a randomized query param to the redirect URL that Better User Activation uses.

Read the Walkthrough

Code

Filename: gpbua-prevent-redirect-caching.php

<?php
/**
 * Gravity Perks // Better User Activation // Prevent Redirect Caching
 * https://gravitywiz.com/documentation/gravity-forms-better-user-activation/
 *
 * Plugin Name:  Better User Activation - Prevent Redirect Caching
 * Plugin URI:   https://github.com/gravitywiz/snippet-library/blob/master/gp-better-user-activation/gpbua-prevent-redirect-caching.php
 * Description:  Adds a randomized query param to the redirect URL that Better User Activation uses.
 * Author:       Gravity Wiz
 * Version:      0.1
 * Author URI:   https://gravitywiz.com
 */
add_filter( 'gpbua_activation_redirect_url', function( $url, $activation ) {
	return add_query_arg( array(
		'rand' => rand( 100000, 999999 ),
	), $url );
}, 10, 2 );

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.