Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to remove the rel="nofollow" from "cancel reply" in wordpress

I am using this code but I am not getting results, the nofollow is still there.

function remove_nofollowcancel($formatted_link, $link, $text){
 return str_replace("rel='nofollow'", "", $formatted_link );
}
add_filter('cancel_comment_reply_link', 'remove_nofollowcancel', 10, 3);

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

have you tried reversing the quotes?

 return str_replace('rel="nofollow"', "", $formatted_link );

When looking at the internals of get_cancel_comment_reply_link the rel attribute is using double quotes.

Docs: https://developer.wordpress.org/reference/functions/get_cancel_comment_reply_link/

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading