llms_verify_nonce( string $nonce, string $action, string $request_method = 'POST' )

Verify nonce with additional checks to confirm request method


Description Description

Skips verification if the nonce is not set Useful for checking nonce for various LifterLMS forms which check for the form submission on init actions.


Parameters Parameters

$nonce

(string) (Required) Name of the nonce field.

$action

(string) (Required) Name of the action.

$request_method

(string) (Optional) Name of the intended request method. Default is 'POST'.

Default value: 'POST'


Top ↑

Return Return

(null|false|int)


Top ↑

Source Source

File: includes/llms.functions.core.php

function llms_verify_nonce( $nonce, $action, $request_method = 'POST' ) {

	if ( strtoupper( getenv( 'REQUEST_METHOD' ) ) !== $request_method ) {
		return;
	}

	if ( empty( $_REQUEST[ $nonce ] ) ) {
		return;
	}

	return wp_verify_nonce( sanitize_text_field( wp_unslash( $_REQUEST[ $nonce ] ) ), $action );

}

Top ↑

Changelog Changelog

Changelog
Version Description
3.8.0
3.35.0 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.