Archived topic
How to disable no referrer tag on external links?
4 replies · Started by Victor on October 6, 2020
Can you guide me on how I can remove the no referrer tag on external links? This is greatly affecting our ability to check analytics for traffic driven from my site.
Hi there,
you can add this PHP snippet:
function my_links_control( $rel, $link ) {
return false;
}
add_filter( 'wp_targeted_link_rel', 'my_links_control', 10, 2 );
I added the code but it didn't really change things. I purged the cache too. Any idea why this may be happening? Do I set it to run snippet everywhere, administration area only, front end, or only once.
Failed to set referrer policy: The value '' is not one of 'no-referrer', 'no-referrer-when-downgrade', 'origin', 'origin-when-cross-origin', 'same-origin', 'strict-origin', 'strict-origin-when-cross-origin', or 'unsafe-url'. The referrer policy has been left unchanged.
I noticed this message when inspecting the page using developer tools. Could this mean something?
Not too sure about this as it's a core WP thing. Lots of different articles if you Google it.
I found this that might be helpful: https://wordpress.stackexchange.com/questions/339323/wp-adding-noopener-and-noreferrer-to-all-links