How to disable URL preview in WordPress comments

(Note that this answer deals with URL previewing in the Admin, Comments area. URLs are not ‘previewed’ in what the visitor sees in your posts’ comments.)

If you inspect the source of the Comments page (in Admin, Comment area, where a link will be previewed if you hover over it), you will see that the code is done by the Akismet plugin, which add this CSS (in akismet.css line 42):

table.comments td.comment p a::after {
    content: attr(href);
    color: #aaa;
    display: inline-block;
    padding: 0 1ex;
}

In that CSS, the ‘content‘ attribute of that CSS rule is using attr(href) to display the content of the href.

Never have liked how Akismet does that. It is possible fora link to be malicious and perhaps install malware code (or execute it) on that href link.

You could probably get rid of that preview with added CSS (in Additional CSS in theme customization):

table.comments td.comment p a::after {
    content:none !important;
    display: none !important;
}

I see this default display of links in the Admin, Comments area as a possible malware problem. But when I asked them about it (last year), there was no indication they saw it as a problem. I still don’t like it, especially since Akismet is a very common plugin on WP sites.