WordPress开发者和主题制作者的搜索引擎



wp_referer_field ›

Since2.0.4
已弃用n/a
wp_referer_field ( $echo = true )
参数:
  • (bool) $echo Optional. Whether to echo or return the referer field. Default true.
    Required: No
    默认: true
返回:
  • (string) Referer field HTML markup.
定义在:
文档:

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.



源码

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;
}