Disable URL in comments in 2017

Hello,

Looking at some spammy comments I was wondering if there is a way to disable URL in comments (link that appears under nickname or name people choose to use when commenting). There were some subjects here about this, but recommended plugins are outdated.

Plugin or option would be great. Solution should not turn off links in comment body.

I would appreciate any suggestions,
Milosz

  • Rupok

    Hi Milosz,

    Thanks for asking. You can replace the links they try to show with the Author name with hash (#) by creating a little MU plugin. That will make sure that your users won't anywhere else even if they click on the Author title. For creating a MU Plugin, create a folder named "mu-plugins" inside your "wp-content" folder. Then inside that "mu-plugins" folder, create a file with any name and with a .php extension. Now paste the code inside that file and save.

    <?php
    add_action( 'wp_footer', 'change_author_link_from_comments' );
    function change_author_link_from_comments() {
        ?>
        <script type="text/javascript">
          jQuery(document).ready(function() {
            jQuery('.comment-author .url').attr('href', '#');
          });
        </script>
        <?php
    }

    For getting more idea on mu plugins, you can go through this article: http://premium.wpmudev.org/manuals/wpmu-manual-2/using-mu-plugins/

    This will keep your links in the comment box untouched.

    Please let us know if this doesn't serve your purpose. We will be glad to help further.

    Have a nice day. Cheers!
    Rupok

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.