Nowadays, a lot of bloggers choose to remove HTML tag from WordPress websites. However, for beginners and newbies in this field, they may feel confused about the practice. Meanwhile, some webmasters may have realized the importance to do so but lack effective solutions. In order to help people out, our professional and experienced editors carefully explain why to remove HTML tags from WordPress and propose multiple channels to achieve the goal.
Why Remove HTML Tag?
By default, WordPress allows visitors to leave basic HTML tags in post comments to extend WordPress functionality, which makes the platform an outstanding content management system. Besides, the practice can indeed promote interactions between visitors, and in return, websites will get good market reputation as well as good ranking place in search engines.
However, some malicious visitors may take advantage of this function and bring benefits to their websites at the cost of harming the reputation your site. If you own a reputable website with considerable traffic, then, some low ranking website managers may leave an HTML tag in the comment section that links back to their website.
Of course, the practice adds a valuable backlink for their websites but may have negative effects on yours. For one thing, when visitors view comments, plenty of meaningless HTML tags will leave negative impressions on them. For the other thing, if visitors click through those tags and are brought to other websites with inferior quality, it is the original website to be blamed.
How to Remove HTML Tags from WordPress?
After reading the content above, you may have a brief idea about how can malicious HTML tags harm your website. Thus, it is impending to remove HTML tags, which can greatly improve website quality, maintain visitors, as well as defend the interests of your website. In the following, our editors present several simple and effective methods to help WordPress site owners erase HTML tags without hassle.
Function.php file has a very wide usage, which is contained in your theme file and decides what features the theme has. Therefore, HTML tags in comment section can be customized easily with this file, which means webmasters can keep preferred tags and delete unwanted ones. Just place the following code at the end of your function.php file.
Once executing the listed code, only italic tag and anchor tag will remain in the comment form, and initial HTML tags will be eliminated.
This is another php file that can be used to wipe out HTML tags. The procedure is so simple that you just need to change a line of code in this file. Firstly, find your comment.php file below your WordPress selected theme folder. Once you open the code, you can see the following code in the file.
When capturing the line, replace it with the following code. Then, HTML tags will never again appear to your comment section.
Style.css file is an alternative method for php files to remove HTML tags in WordPress. Seek out the style.css file under your WordPress selected folder and put the below code at the end of the file. Now, the work is done perfectly.
Apart from achieving your goal with WordPress, you can also utilize WordPress plugins to do so. Coming down to the essence of the problem, it is a matter of spam comments and accordingly, you can use comment plugins to achieve your goal. If you want to be precise, WordPress also offers HTML tag removing plugins.
Our editors pick out some easy-to-use and reputable ones from tens of plugins and give their links in below. Thus, if you prefer to reach your goals with plugins, just pick one from the listed widgets.