function wp_original_referer_field( $echo = true, $jump_back_to = 'current' ) {}

Retrieve or display original referer hidden field for forms.
The input name is ‘_wp_original_http_referer’ and will be either the same value of wp_referer_field(), if that was posted already or it will be the current page, if it doesn’t exist.


  • bool $echo: Whether to echo the original http referer
  • string $jump_back_to: Optional, default is ‘current’. Can be ‘previous’ or page you want to jump back to.

Return values

returns:Original referer field.

Source code

function wp_original_referer_field( $echo = true, $jump_back_to = 'current' ) {

	$jump_back_to = ( 'previous' == $jump_back_to ) ? wp_get_referer() : $_SERVER['REQUEST_URI'];

	$ref = ( wp_get_original_referer() ) ? wp_get_original_referer() : $jump_back_to;

	$orig_referer_field = '<input type="hidden" name="_wp_original_http_referer" value="' . esc_attr( stripslashes( $ref ) ) . '" />';

	if ( $echo )

		echo $orig_referer_field;

	return $orig_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: