wp_nonce_field


wp_nonce_field ( $action = -1, $name = '_wpnonce', $referer = true, $display = true )

Parameters:
  • (int|string) action Optional. Action name. Default -1.
  • (string) name Optional. Nonce name. Default '_wpnonce'.
  • (bool) referer Optional. Whether to set the referer field for validation. Default true.
  • (bool) display Optional. Whether to display or return hidden form field. Default true.
Returns:
  • (string) Nonce field HTML markup.
Defined at:

Description

Retrieves or display nonce hidden field for forms.The nonce field is used to validate that the contents of the form came from the location on the current site and not somewhere else. The nonce does not offer absolute protection, but should protect against most cases. It is very important to use nonce field in forms. The $action and $name are optional, but if you want to have better security, it is strongly suggested to set those two parameters. It is easier to just call the function without any parameters, because validation of the nonce doesn't require any parameters, but since crackers know what the default is it won't be difficult for them to find a way around your nonce and cause damage. The input name will be whatever $name value you gave. The input value will be the nonce creation value.

Related Functions

signup_nonce_fields, wp_nonce_url, wp_nonce_tick, wp_nonce_ays, wp_referer_field

Top Google Results

User discussions

wpseek mobile