[Resolved] How to disable no referrer tag on external links?

Home Forums Support [Resolved] How to disable no referrer tag on external links?

Home Forums Support How to disable no referrer tag on external links?

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #1474395
    Victor

    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.

    #1474835
    David
    Staff
    Customer Support

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

    https://docs.generatepress.com/article/adding-php/

    #1475943
    Victor

    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.

    #1476035
    Victor

    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?

    #1477085
    Tom
    Lead Developer
    Lead Developer

    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

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.