In this tutorial, we’re going to walk through the steps on how to remove the Rank Math link class from the outbound links.
In the Rank Math plugin, we overwrite Gutenberg’s link module to add nofollow
& sponsored
attributes. The rank-math-link
is a unique class that is needed to overwrite the default module.
However, you can paste the following code in your theme’s rank-math.php file to remove the rank-math-link
class.
Navigate to WordPress Dashboard → Appearance → Theme File Editor (for Classic Theme) or WordPress Dashboard → Tools → Theme File Editor (for Block Theme).
Now click rank-math.php
from theme files. Make sure that you are editing the child theme so as to ensure the safety and smooth running of the website.
Now use the below-shown code snippet to add and then click Update File to reflect the changes.
/**
* Filter to remove `rank-math-link` class from the frontend content links
*/
add_filter( 'rank_math/link/remove_class', '__return_true' );
Doing this will essentially render the nofollow
and sponsored
options for outbound links to be useless:
We offer other options for links at WordPress Dashboard → Rank Math SEO → General Settings → Links as well. You can read more about each setting in our General Settings guide. If you still have any questions, please feel free to contact our support team who are available 24×7 and will help you out as soon as possible.