wp_nonce_url( string $actionurl, int|string $action = -1, string $name = '_wpnonce' ): string

Retrieves URL with nonce added to URL query.

Parameters

$actionurlstringrequired
URL to add nonce action.
$actionint|stringoptional
Nonce action name.

Default:-1

$namestringoptional
Nonce name. Default '_wpnonce'.

Default:'_wpnonce'

Return

string Escaped URL with nonce action added.

Source

function wp_nonce_url( $actionurl, $action = -1, $name = '_wpnonce' ) {
	$actionurl = str_replace( '&', '&', $actionurl );
	return esc_html( add_query_arg( $name, wp_create_nonce( $action ), $actionurl ) );
}