How to nofollow links in default related posts widget of WordPress

Find the file default-widgets.php in wp-includes folder of WordPress Installation. Keep a backup of the original file incase you make mistake. Find the following lines of code under Recent_Posts widget class

<li><a href="<?php the_permalink() ?>" title="<?php echo esc_attr(get_the_title() ? get_the_title() : get_the_ID()); ?>"><?php if ( get_the_title() ) the_title(); else the_ID(); ?></a></li>

Change it to these. We have added the rel=”nofollow” attribute for the link elements of related post links

<li><a rel="nofollow" href="<?php the_permalink() ?>" title="<?php echo esc_attr(get_the_title() ? get_the_title() : get_the_ID()); ?>"><?php if ( get_the_title() ) the_title(); else the_ID(); ?></a></li>

Refresh the WordPress posts or pages where you have configured the default related posts widget. The links of the Widget have become nofollowed.

  • http://www.gahe.co/ Gahe

    Thanks for giving me the useful information. I think I need it. Thank you

  • http://www.friv2.org/Flappy_Bird.html flappy bird

    You have some dedicated information throughout this text. I even have
    extraordinarily enjoyed your views on this subject. you are a precocious
    author. Thank you.

  • http://www.frivlink.com/ frivlink

    Thanks for giving me the useful information…