Automattic\WooCommerce\Admin\API

Notes::maybe_add_nonce_to_url()privateWC 1.0

Maybe add a nonce to a URL.

Метод класса: Notes{}

Хуков нет.

Возвращает

Строку. A fully formed URL.

Использование

// private - только в коде основоного (родительского) класса
$result = $this->maybe_add_nonce_to_url( $url, $action, $name ) : string;
$url(строка) (обязательный)
The URL needing a nonce.
$action(строка)
The nonce action.
По умолчанию: ''
$name(строка)
The nonce anme.
По умолчанию: ''

Код Notes::maybe_add_nonce_to_url() WC 8.7.0

private function maybe_add_nonce_to_url( string $url, string $action = '', string $name = '' ) : string {
	if ( empty( $action ) ) {
		return $url;
	}

	if ( empty( $name ) ) {
		// Default paramater name.
		$name = '_wpnonce';
	}

	return add_query_arg( $name, wp_create_nonce( $action ), $url );
}