Site logo

Archived topic

Disable links in WordPress Comments (except those from registered users)

3 replies · Started by Hilton on October 11, 2019

Viewing posts 1–4 of 4

Hi,

We recently decided to disable all links that were active within the comments, but we want the links posted by our registered users (contributor, editor, author) to remain active.

We added this function to functions.php but it has disabled all links in comments, including those posted by our registered users.

add_filter ('pre_comment_content', 'wp_specialchars'); // disable HTML in comments
remove_filter ('comment_text', 'make_clickable', 9); // autolinks in comments

How can we disable all links, leaving clickable only the links of our users (contributor, editor, author)?

Thanks

Hi there,

I believe this would require a custom solution and the theme doesn't handle this at all as the comment system is handled by WordPress itself

You'd need to check with their support to see if they have any suggestions.

If not then might be helpful to post on a general forum like https://stackoverflow.com/

Ok Leo, thanks

No problem :)

This archived topic is closed to new replies.