0

I disabled URL embed in Wordpress using the following code in functions.php:

function my_deregister_scripts(){
 wp_dequeue_script( 'wp-embed' );
}
add_action( 'wp_footer', 'my_deregister_scripts' );

The embedded iframe is gone, but the link is still not showing. I only get the page title linked to that URL (and within a blockquote, I don't know why).

How can I simply post a link in Wordpress comments and have it show up as is:

http://www.example.com

Thanks!

2
  • I'm not sure I understand, WordPress doesn't support OEmbed in comments out of the box. Something on your site perhaps a theme or a plugin has added oembeds to your comments. Normal WordPress does not support embeds in comments. You should look at your plugins and themes and identify which one is adding this behaviour to your site – Tom J Nowell Feb 23 '20 at 20:44
  • Does this answer your question? Remove link preview in discussion dashboard – Jani Uusitalo Jan 3 at 12:56
0

(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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.