Schedule a Free Consultation
Add html Comments Using Newly Created User Role

Add html Comments Using Newly Created User Role

Read Article

I was recently working on a piece of code that will:

  • create as special user role
  • allow that user role to insert HTML comments on posts (specifically we needed images and links) from wp-admin

If I was commenting like admin, all was good – the comment with image was getting published. But if instead I was commenting using that user role, unfortunately all the HTML got stripped.

After some debugging inside WordPress, I found the culprit, which, by the way, it’s a feature of WordPress – the unfiltered_html capability for my user role. Basically if you have a newly defined user role that you want to be able to insert HTML in comments, you have to add that capability to your new user role. Here’s the simple snippet:

Once again, the best documentation for WordPress is the actual source code.

Follow the code and you will see the light 🙂

Navigate to

You Might Also Enjoy These Digital Marketing Articles:

How To Optimize Your WordPress Online Learning Platform for Real-Time Interaction
Online education has been around since the late 1900s, but it wasn’t until COVID-19 halted the world in 2020 that online learning was thrust into the spotlight. With physical classrooms out of commission across the globe, virtual classrooms became the norm overnight. This sudden shift revealed a major limitation of many online learning platforms—the lack […]
Unlocking the Potential of WordPress Themes: A Discovery Journey
Choosing the perfect WordPress theme can seem like an overwhelming task. With thousands of options, how do you find the ideal theme for your business website? The good news is, the process doesn’t have to be painfully tedious. You can discover amazing themes tailored to your brand and website needs with a strategic approach.  In […]