Hello,
Thank you for contacting Rank Math and sorry for any inconvenience that might have been caused due to that.
I can suggest that you use the below filter to create some logic to target the homepage and create a custom title for this page:
/**
* Filter to change the page title.
*
* @param string $title
*/
add_filter( 'rank_math/frontend/title', function( $title ) {
return $title;
});
Looking forward to helping you. Thank you.
​​​​​​​
Thanks for your fast reply.
I’m a bit noob in programming. Shall I add this filter to the homepage custom code or somewhere else?
I think i should replace $title with my own title. Yes?
Hello Vahid,
Thanks for the reply.
No worries, could you please try the following code?
Please note that it is untested and should be added to your theme’s functions.php file:
/**
* Filter to change the page title.
*
* @param string $title
*/
add_filter( 'rank_math/frontend/title', function( $title ) {
if(is_home() || is_front_page()){
$title = 'Enter the custom homepage title here';
return $title;
}
return $title;
});
I hope this info helps. Thank you.
work like a charm.
thanks
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.