Do you have comments enabled on your WordPress website? It’s a great way to gather feedback from your readers or engage in discussions on the topics you write about. However, like almost everything, comments come with their own challenges. One of them might be unwanted links that lead to websites you wouldn’t want to associate with your blog, even in the comments section. There’s a way you can easily prevent this issue. You can actually disable URL links in comments. If you want to steer clear of links for any reason, here’s a very simple way: How to easily disable links in WordPress comments.
How to easily disable links in WordPress comments
To avoid installing an additional plugin for these purposes, we’ll use a snippet and the popular WPCode plugin, which should be installed by anyone looking to customize the properties and behavior of their WordPress website. A snippet is nothing more than a short piece of code in PHP or another language that modifies the properties and behavior of a website.
Installation of the WPCode plugin
To insert codes into your website, you have two options. You can either insert the code directly into the file where it belongs, or you can use a plugin that dynamically inserts parts of the code while your website runs. The second option is better for a simple reason: it’s safer and ensures your code won’t get wiped out with each update that overwrites the file containing your code.
Here’s how to install the WPCode plugin:
- Click on ‘Plugins‘ in the left menu.
- Select ‘Add New‘ from the submenu.
- Notice the search bar in the top right corner.
- Type ‘WPCode‘ into the search bar.
- Once WordPress finds the plugin, install and activate it.
If you’re interested in the full article where I describe working with this plugin, take a look here: How to insert custom codes into WordPress
How to easily disable links in WordPress comments
To disable URLs in the comments on your website, use this simple snippet:
remove_filter( 'comment_text', 'make_clickable', 9 );
This snippet solely removes the ‘make_clickable’ filter from the comment text application. This filter typically converts text URLs into clickable links. While this feature can be occasionally useful, it also brings various security issues. By eliminating this filter, you prevent the conversion of text URLs into clickable links.
Conclusion
As you can see, the snippet is really short and can be inserted into your website within a few minutes, including the installation of the WPCode plugin. Moreover, the WPCode plugin can be utilized in many other instances where you might want to modify your website using different, often very useful snippets.
The website is created with care for the included information. I strive to provide high-quality and useful content that helps or inspires others. If you are satisfied with my work and would like to support me, you can do so through simple options.
Byl pro Vás tento článek užitečný?
Klikni na počet hvězd pro hlasování.
Průměrné hodnocení. 1 / 5. Počet hlasování: 1
Zatím nehodnoceno! Buďte první
Je mi líto, že pro Vás nebyl článek užitečný.
Jak mohu vylepšit článek?
Řekněte mi, jak jej mohu zlepšit.
Subscribe to the Newsletter
Stay informed! Join our newsletter subscription and be the first to receive the latest information directly to your email inbox. Follow updates, exclusive events, and inspiring content, all delivered straight to your email.