function wp_referer_field( $echo = true ) {}

Retrieve or display referer hidden field for forms.
The referer link is the current Request URI from the server super global. The input name is ‘_wp_http_referer’, in case you wanted to check manually.


  • bool $echo: Whether to echo or return the referer field.

Return values

returns:Referer field.

Source code

function wp_referer_field( $echo = true ) {

	$ref = esc_attr( $_SERVER['REQUEST_URI'] );

	$referer_field = '<input type="hidden" name="_wp_http_referer" value="'. $ref . '" />';

	if ( $echo )

		echo $referer_field;

	return $referer_field;



No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: