Hello,
Thank you for contacting Rank Math and sorry for any inconvenience that might have been caused due to that.
Please add the following code to your theme’s functions.php file and let me know how it works for you:
/**
* Only load if Rank Math plugin is activated
*/
if ( defined( 'RANK_MATH_FILE' ) && 'layout' === get_option( 'show_on_front' ) ) {
/**
* Adjusting homepage's title tag
* @return string
*/
function extra_rank_math_homepage_title_adjustment( $title ) {
if ( is_home() ) {
$title = RankMath\Helper::replace_vars( RankMath\Helper::get_settings( 'titles.homepage_title' ) );
}
return $title;
}
add_filter( 'rank_math/frontend/title', 'extra_rank_math_homepage_title_adjustment', 16 );
/**
* Adjusting homepage's meta description
* @return string
*/
add_filter( 'rank_math/frontend/description', function( $description ) {
if ( is_home() ) {
$description = RankMath\Helper::replace_vars( RankMath\Helper::get_settings( 'titles.homepage_description' ) );
}
return $description;
});
/**
* Adjusting homepage's robots
* @return string
*/
add_filter( 'rank_math/frontend/robots', function( $robots ) {
if ( is_home() && RankMath\Helper::get_settings( 'titles.homepage_custom_robots' ) ) {
$robots = RankMath\Helper::get_settings( 'titles.homepage_robots' );
if ( ! is_array( $robots ) || ! in_array( 'noindex', $robots ) ) {
$robots['index'] = 'index';
}
if ( ! is_array( $robots ) || ! in_array( 'nofollow', $robots ) ) {
$robots['follow'] = 'follow';
}
}
return $robots;
});
}
Looking forward to helping you. Thank you.
Worked perfectly sir. Thank you!
Hello,
We are super happy that this resolved your issue. If you have any other questions in the future, know that we are here to help you.
If you don’t mind me asking, could you please leave us a review (if you haven’t already) on https://wordpress.org/support/plugin/seo-by-rank-math/reviews/?rate=5#new-post about your overall experience with Rank Math? We appreciate your time and patience.
If you do have another question in the future, please feel free to create a new forum topic, and it will be our pleasure to assist you again.
Thank you.