Disable clickable links in Wordpress comments

I have noticed more and more links to commercial Magento extensions in the comments of my blog. That is pretty normal, cause my Magento extensions aren't free of conflicts with other extensions and people just want to give me a hint. But sometimes I'm not sure if they just want to ask a stupid question and make their link. SEO isn't my hot topic. Everything I know is, good content and backlinks are important. I always visit the website of an comment and sometimes I remove their link to an commercial Magento extension shop. But I would like to disable the links in the comments. So I have decided to make all links in comments not clickable.

Creating a Wordpress child theme

Funny, that I call myself a PHP developer, run my Wordpress blog since 3 years I would say and never took a real look inside. I like to use Wordpress, but I didn't like to work with it. I have found a good post about Remove Spam Links From Wordpress Comments, but I didn't liked the idea to write changes to the wordpress code. That's why I have decided to create a child theme. Here is a post that describes Child Themes in Wordpress. Both posts together are my solution. If you already have child theme, just follow the description in the first post. At the moment I use the twentyfifteen theme from Wordpress. I just have to create a theme directory twentyfifteen-child with a fucntions.php and a style.css inside.

.
|-- wp-admin/
|-- wp-content/
|   |-- plugins/
|   |-- themes/
|   |   |-- twentyfifteen/
|   |   `-- twentyfifteen-child/
|   |-- upgrade/
|   `-- uploads/
`-- wp-includes/

style.css

The style.css should look like this

/*
 Theme Name:   Twenty Fifteen Child
 Theme URI:    http://gordonlesti.com/
 Description:  Twenty Fifteen Child Theme
 Author:       Gordon Lesti
 Author URI:   http://gordonlesti.com/
 Template:     twentyfifteen
 Version:      1.0.0
 License:      GNU General Public License v2 or later
 License URI:  http://www.gnu.org/licenses/gpl-2.0.html
 Tags:         light, dark, two-columns, right-sidebar, responsive-layout, accessibility-ready
 Text Domain:  twenty-fifteen-child
*/

functions.php

The functions.php should look like this

<?php

remove_filter('comment_text', 'make_clickable', 9);

add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );
function theme_enqueue_styles() {
    wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
}

Activate the child theme

That's all, we just have to enable the child theme under Appearance => Themes and all comments are plain text without any clickable link.

Next Previous