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

    Hi Support
    I want to add No Follow to external links. I’ve searched through previous threads and very confused.

    Please can you explain it simply How do we add No Follow to external links?

    Thanks, heaps
    Dave

    #1276838

    Hi Dave,

    We have no setting for that, however, you can add this code in functions.php:

    function nofollow_links() {
    ?>
    <script>
    (function ($) {
        $(document).ready (function () {
            var url = new RegExp(location.host);
    
            $('#top .a').each(function () {
                if( ! url.test($(this).attr('href')) ) {
                    $(this).attr('rel', 'nofollow');
                }
            });
        });
    }) (jQuery);
    </script>
    <?php
    }
    add_action ('wp_footer', 'nofollow_links');

    this script should check all the links and if it’s an external link it will add the nofollow to the link.

    Best regards,
    Nikko

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