wpseek.com
Eine auf WordPress spezialiserte Suchmaschine für Entwickler und Theme-Autoren



wp_referer_field › WordPress Function

Seit2.0.4
Veraltetn/v
wp_referer_field ( $display = true )
Parameter:
  • (bool) $display Optional. Whether to echo or return the referer field. Default true.
    Erforderlich: Nein
    Standard: true
Gibt zurück:
  • (string) Referer field HTML markup.
Definiert in:
Codex:

Retrieves or displays 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.


Quellcode

function wp_referer_field( $display = true ) {
	$request_url   = remove_query_arg( '_wp_http_referer' );
	$referer_field = '<input type="hidden" name="_wp_http_referer" value="' . esc_url( $request_url ) . '" />';

	if ( $display ) {
		echo $referer_field;
	}

	return $referer_field;
}