Jul
8
2009
How to remove the links from tags in WordPress
You may have noticed on this blog that the tags don’t have hyper links associated with them (go on, hover over one and have a look for yourself).
The reason I’ve done this is two fold:
The page rank of a blog can dissapear into all those tag pages, meaning google can’t work out if the most important pages are your posts of your tags
I don’t want people coming to my ugly tag pages, I want them coming straight to the posts.
In some circumstances you may feel a simliar way, and if you want to remove the links from your tags here is how to do it:
- Open up wp-includes/category-template.php
- Around line 890 change the following code (old code is commented out)
- // $term_links[] = ‘<a href=”‘ . $link . ‘” rel=”tag”>’ . $term->name . ‘</a>’;
$term_links[] = $term->name; - Around line 670 make the following code change
- $a[] = “$tag_name”;
// $a[] = “<a href=’$tag_link’ class=’tag-link-$tag_id’ title=’” . esc_attr( $topic_count_text_callback( $count ) ) . “‘$rel style=’font-size: ” .
// ( $smallest + ( ( $count – $min_count ) * $font_step ) )
// . “$unit;’>$tag_name</a>”;
And there you go. If you upgrade your Worpress install make sure you back the category file up, as it may overwrite it.