Warning: This function has been deprecated. Use isset() and wp_verify_nonce() directly instead.
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'
Return Return
(null|false|int)
Source Source
File: includes/llms.functions.core.php
function llms_verify_nonce( $nonce, $action, $request_method = 'POST' ) {
_deprecated_function( __FUNCTION__, '10.0.0', 'isset() and wp_verify_nonce()' );
/**
* Filter whether to use $_SERVER instead of getenv when fetching an environment variable.
*
* @since 9.0.0
*/
$server_request_method = apply_filters( 'llms_use_server_for_environment_fetch', false, $nonce, $action, $request_method ) ?
$_SERVER['REQUEST_METHOD'] :
getenv( 'REQUEST_METHOD' );
if ( strtoupper( $server_request_method ) !== $request_method ) {
return;
}
if ( empty( $_REQUEST[ $nonce ] ) ) {
return;
}
return wp_verify_nonce( sanitize_text_field( wp_unslash( $_REQUEST[ $nonce ] ) ), $action );
}
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
| Version | Description |
|---|---|
| 10.0.0 | Use isset() and wp_verify_nonce() directly. |
| 3.8.0 | This function has been deprecated. Use isset() and wp_verify_nonce() directly instead. |
| 3.35.0 | Introduced. |