Code to “nofollow” Links on the Home Page/ Front Page of WordPress

/* NoFollow Specific WordPress Page */
add_action('wp_head', 'wpflt_header_function_condition_nofollow_page_single');
function wpflt_header_function_condition_nofollow_page_single(){
if ( is_front_page() ) { ?>
<meta name="robots" content="nofollow" />
<?php }
};

Here is a simple filter to add ‘nofollow’ metatag to Front Page in WordPress. All the links on this page will be not be followed

Important,

In the line 4, we have used is_front_page() filter. This means, no matter what page you use as your site’s front page, this code will apply. If you use is_home(), then this will affect only the ‘All Post Archive‘ page and not for the FrontPage of your site.

Even if you have multiple pages to be set as home page, periodically, use is_front_page() filter. There are folks who change their front page seasonally.