Change how the categories are listed for posts

Most themes have a link to each category in underneath the title of the post on the individual posts.

These links are rarely if ever, styled, and in most cases push “link-juice” toward the category page.

This is not good for SEO, so the best solution is to change the way the categories for the post is displayed.

You will have to edit your theme for this, so this is not for beginners.

1. Find and locate your “single.php” file in your theme.

2. Find the following code

<?php the_category(', ') ?>

Now, there are several ways to change it. The first solution is to simply list the categories without having any links to them. That can be done by replacing above code with the following:

foreach((get_the_category()) as $category) {
echo $category->cat_name . ' ';

This just lists all categories as a long line.

The second solution is to list the categories as you usually would, but by adding rel=”nofollow” to the links, so you do not pass link-juice to the category pages.

This can be done with the following code:

foreach((get_the_category()) as $category) {
if ($catcount>1) {echo ', '; }
echo '<a href='.get_category_link($category->cat_ID).' rel='nofollow category tag'>' . $category->cat_name. '</a>';


The $catcount variable is a little code I added which displays a comma if there are more than one category. If we did not check for this, the code would simply add a comma every time, even if there was just one category listed.

Read also  Get Post Title Outside "The Loop"

If you want to use something else such as “and”  instead of the ,”” comma, change the following line:

if ($catcount<1) {echo ', '; }


if ($catcount>1) {echo 'and '; }

If you are looking for other tips and tricks, check out Setting Featured Image via code or WordPress Multisite Search.

4 Useful WordPress Tools for Data Visualization

Data visualization involves taking raw data and converting it into visually appealing presentations which readers can easily digest. Visualizing data on WordPress is an amazing way of drawing your reader's attention to the X factor in your posts. As a WordPress user,...

Move Your WordPress Site to a New Domain (Without Hurting SEO)

Move Your Wordpress Site to New Domain Without Hurting SEO  Your site is your brand's home. It is how you welcome new relationships and maintain those already established. You have a history with your site. It has been there from the start as a partner of sorts. It...

Error: Please enter a valid email address

Error: Invalid email

Error: Please enter your first name

Error: Please enter your last name

Error: Please enter a username

Error: Please enter a password

Error: Please confirm your password

Error: Password and password confirmation do not match