W3cubDocs

/WordPress

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

Retrieve URL with nonce added to URL query.

Description

Parameters

$actionurl

(string) (Required) URL to add nonce action.

$action

(int|string) (Optional) Nonce action name.

Default value: -1

$name

(string) (Optional) Nonce name.

Default value: '_wpnonce'

Return

(string) Escaped URL with nonce action added.

Source

File: wp-includes/functions.php

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 ) );
}

Changelog

Version Description
2.0.4 Introduced.

© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/wp_nonce_url