Skip to content
Docs
Get RestroPress

Filter

rpress_get_user_verification_token_args

Updated
On this page

Filters the extra query arguments used when generating a verification token.

Runs in rpress_get_user_verification_token() after core adds ip and user_agent arguments based on the o query parameter of the URL. Use it to add custom values to the token calculation. The secret and token arguments are added afterwards.

Parameters#

ParameterTypeDescription
$argsarrayArguments added to the URL before the token is computed.
$urlstringThe URL the token is being generated for.
$optionsarrayOption names from the o query parameter of the URL, for example ip or ua.

Return value#

array. The filtered arguments.

Example#

function my_verification_token_args( $args, $url, $options ) {
	if ( in_array( 'host', $options, true ) && isset( $_SERVER['HTTP_HOST'] ) ) {
		$args['host'] = rawurlencode( sanitize_text_field( wp_unslash( $_SERVER['HTTP_HOST'] ) ) );
	}
	return $args;
}
add_filter( 'rpress_get_user_verification_token_args', 'my_verification_token_args', 10, 3 );

Notes#

Raw-URL-encode custom values so the token matches when it is regenerated for validation.

Source#

Applied in:

  • includes/user-functions.php (line 741), in rpress_get_user_verification_token()
Was this page helpful?