WordPress Version: 6.1
/**
* Retrieves URL with nonce added to URL query.
*
* @since 2.0.4
*
* @param string $actionurl URL to add nonce action.
* @param int|string $action Optional. Nonce action name. Default -1.
* @param string $name Optional. Nonce name. Default '_wpnonce'.
* @return string Escaped URL with nonce action added.
*/
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));
}