Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

loiste2 on "Override the Wordpress core function wp_referer_field"

$
0
0

I'd like to override the core Wordpress function wp_referer_field with folowing code:

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

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

I've found that wp_referer_field is not pluggable and that I need to use some other technics for that. Adding some filters or actions. I was trying to use these code:

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

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

But it doesn't work. It seems that I did something wrong.


Viewing all articles
Browse latest Browse all 8245

Trending Articles