We use Genesis theme for our WordPress site to get speed and performance. After installed the WordPress and Genesis themes (Zigzagpress’s Showroom Theme) we don’t extra care about our site’s internal linking.

Suppose, sidebar widget or footer widget, we add recent posts widget or featured posts widget. But we don’t care that these widget making internal links which will effect to our on-page SEO.

So, I’m going to share some strategy to apply after each WordPress installation and after each update.

Add the codes below to your Genesis child theme’s functions.php file end.

// Started some SEO options hooks

//This code removes noreferrer from your new or updated posts
add_filter( 'wp_targeted_link_rel', 'remove_targeted_link_rel_noreferrer',999);
function remove_targeted_link_rel_noreferrer( $rel_values ) {
return preg_replace( '/noreferrer\s*/i', 'external', $rel_values );
}

// Remove URL/Website field in Comment form
add_filter('comment_form_default_fields','remove_comment_url');
function remove_comment_url($fields) { 
unset($fields['url']);
return $fields;
}

// Login page logo.
function my_login_logo() { ?>
    <style type="text/css">
        #login h1 a, .login h1 a {
            background-image: url(<?php echo get_site_url(); ?>/wp-content/uploads/login-logo.png);
			padding-bottom: 30px;
        }
    </style>
<?php }
add_action( 'login_enqueue_scripts', 'my_login_logo' );

function my_login_logo_url() {
    return home_url();
}
add_filter( 'login_headerurl', 'my_login_logo_url' );

function my_login_logo_url_title() {
    return get_bloginfo();
}
add_filter( 'login_headertitle', 'my_login_logo_url_title' );

// Ended SEO options hooks

Make sure you have uploaded the login page logo to your site (/wp-content/uploads/login-logo.png)

Change Widget’s rel tag:

Now we need to edit the three files manually.

/wp-includes/widgets/class-wp-widget-recent-posts.php
/wp-content/themes/genesis/lib/widgets/featured-post-widget.php
/wp-content/plugins/simple-social-icons/simple-social-icons.php
or, /wp-content/themes/showroom/lib/widgets/widget-social_icons.php

Open the above three files in Notepad++

Search for href and add rel="nofollow"  before “href” and save the files. Upload the files.

Additionally, we can add rel=”nofollow” to the tag cloud.

/wp-includes/category-template.php

Search for wp_generate_tag_cloud_data and add rel=”nofollow” in this section.

If you want to change the single post’s rel tag, do the following:

wp-content/themes/genesis/lib/shortcodes/post.php

Find ahref= from genesis_post_author_posts_link_shortcode section, and add rel=”author nofollow”. And look at the next section (comment section) if you add rel tag to Leave a comment link rel=”nofollow”.

/wp-includes/category-template.php

Find href= from get_the_term_list section, and add rel=”tag nofollow”.

Find rel=”category tag” and replace with rel=”category nofollow”.

 

You can directly search and replace in cPanel file manager editor also.