Function
Verify the signup form nonce.
Core's signup_nonce_check() only runs on wp-signup.php.
tml_ms_signup_nonce_check( array $result )
Parameters
-
$resultarray - The signup validation result.
Return
array
The signup validation result.
Source
function tml_ms_signup_nonce_check( $result ) {
$nonce = isset( $_POST['_signup_form'] ) ? sanitize_text_field( wp_unslash( $_POST['_signup_form'] ) ) : '';
$form_id = isset( $_POST['signup_form_id'] ) ? absint( $_POST['signup_form_id'] ) : 0;
if ( ! wp_verify_nonce( $nonce, 'signup_form_' . $form_id ) ) {
// phpcs:ignore WordPress.WP.I18n.MissingArgDomain -- reusing WP core's translated wp-signup.php string verbatim.
$result['errors']->add( 'invalid_nonce', __( 'Unable to submit this form, please try again.' ) );
}
return $result;
}
Uses
Changelog
| Version | Description |
|---|---|
| 7.3.1 | Introduced. |