[Support request] Remove noreferrer from external links

Home Forums Support [Support request] Remove noreferrer from external links

Home Forums Support Remove noreferrer from external links

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #825230
    Vijaykumar

    Hi
    With new Gutenberg and WordPress update, there is a functionality to add “noreferrer” back again for ALL the external links.

    but in most of the cases, we only need “noopener”.

    Is there any support/hook from GP to disable adding noreferrer to external links?

    I got a function to do this. Will this cause any issues?

    add_filter( ‘wp_targeted_link_rel’, ‘my_targeted_link_rel_remove_noreferrer’ );
    function my_targeted_link_rel_remove_noreferrer( $rel_values ) {
    return preg_replace( ‘/noreferrer\s*/i’, ”, $rel_values );
    }

    Also, when I try to edit functions.php I see a message not to edit it and edit the child theme instead. Can I know how to do that and which file to edit?

    #825403
    David
    Staff
    Customer Support

    Hi there,

    can’t see the code being an issue.

    This article covers how to add PHP:

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

    In this case you would be better to use the Code Snippets plugin that is referenced in that article. Setting up a child theme for one function isn’t worth it.

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