wp_referer_field( bool $echo = true )

Retrieve or display referer hidden field for forms.

Description Description

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.

Parameters Parameters


(bool) (Optional) Whether to echo or return the referer field.

Default value: true

Top ↑

Return Return

(string) Referer field HTML markup.

Top ↑

Source Source

File: wp-includes/functions.php

function wp_referer_field( $echo = true ) {
	$referer_field = '<input type="hidden" name="_wp_http_referer" value="' . esc_attr( wp_unslash( $_SERVER['REQUEST_URI'] ) ) . '" />';

	if ( $echo ) {
		echo $referer_field;
	return $referer_field;

Top ↑

Changelog Changelog

Version Description
2.0.4 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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