How To Disable HTML in WordPress Comments

If you don’t want users to post HTML in comments on your site, you can post the code below into your WordPress theme’s functions.php file:


/* Disable Hyperlinks in WordPress Comments */
remove_filter('comment_text', 'make_clickable', 9);
add_filter('pre_comment_content', 'strip_comment_links');

function strip_comment_links($content) {

global $allowedtags;

$tags = $allowedtags;
unset($tags['a']);
$content = addslashes(wp_kses(stripslashes($content), $tags));

return $content;
}

Other Helpful Articles

Creating A Blog Post in WordPress

Creating a blog post in WordPress is a great way to add fresh content to your site. However, make sure that your site was built with a blog feature. Here are steps on how to create a new blog post in WordPress: Log into your WordPress site Go to yoursite.com/admin

Read More »
Smart Web Creative - Knowledge Base - How to Recover WordPress Additional CSS

How to Recover WordPress Additional CSS

How to Recover WordPress Additional CSS in 2023 (Step-by-Step) – If you have ever lost additional CSS within your WordPress theme, we’ll show you how you can most likely recover it in this step-by-step tutorial. First, we will go over what CSS is, how you can add custom CSS in

Read More »

Choosing A Domain Name

Selecting a domain name for your website is one of the first things a website needs and probably one of the most difficult. The domain name is what someone types into the URL box on a browser to get to a site. Think of it as an unique location identifier

Read More »

What Do You Need Done?:

(Please check all that apply)

Tell Us About You

Almost Done!

Let's Get Some Info

Let's Get Some Info

Let's Get Some Info

Let's Get Some Info

Let's Get Some Info